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 local variable
bitxbay/BitXBay/electru/build/lib/electrum_gui/qt/transaction_dialog.py
[ { "content": " def __init__(self, tx, parent):\n self.tx = tx\n tx_dict = tx.as_dict()\n self.parent = parent\n self.wallet = parent.wallet\n \n QDialog.__init__(self)\n self.setMinimumWidth(600)\n self.setWindowTitle(_(\"Transaction\"))\n self.setModal(1)\n\n vbox = QVBoxLayout()\n self.setLayout(vbox)\n\n vbox.addWidget(QLabel(_(\"Transaction ID:\")))\n self.tx_hash_e = QLineEdit()\n self.tx_hash_e.setReadOnly(True)\n vbox.addWidget(self.tx_hash_e)\n self.status_label = QLabel()\n vbox.addWidget(self.status_label)\n\n self.date_label = QLabel()\n vbox.addWidget(self.date_label)\n self.amount_label = QLabel()\n vbox.addWidget(self.amount_label)\n self.fee_label = QLabel()\n vbox.addWidget(self.fee_label)\n\n self.add_io(vbox)\n\n vbox.addStretch(1)\n\n buttons = QHBoxLayout()\n vbox.addLayout( buttons )\n\n buttons.addStretch(1)\n\n self.sign_button = b = QPushButton(_(\"Sign\"))\n b.clicked.connect(self.sign)\n buttons.addWidget(b)\n\n self.broadcast_button = b = QPushButton(_(\"Broadcast\"))\n b.clicked.connect(self.broadcast)\n b.hide()\n buttons.addWidget(b)\n\n self.save_button = b = QPushButton(_(\"Save\"))\n b.clicked.connect(self.save)\n buttons.addWidget(b)\n\n cancelButton = QPushButton(_(\"Close\"))\n cancelButton.clicked.connect(lambda: self.done(0))\n buttons.addWidget(cancelButton)\n cancelButton.setDefault(True)\n \n self.update()", "metadata": "root.TxDialog.__init__", "header": "['class', 'TxDialog', '(', 'QDialog', ')', ':', '___EOS___']", "index": 40 }, { "content": " def update(self):\n\n is_relevant, is_mine, v, fee = self.wallet.get_tx_value(self.tx)\n\n if self.tx.is_complete:\n status = _(\"Status: Signed\")\n self.sign_button.hide()\n tx_hash = self.tx.hash()\n\n if tx_hash in self.wallet.transactions.keys():\n conf, timestamp = self.wallet.verifier.get_confirmations(tx_hash)\n if timestamp:\n time_str = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]\n else:\n time_str = 'pending'\n status = _(\"Status: %d confirmations\")%conf\n self.broadcast_button.hide()\n else:\n time_str = None\n conf = 0\n self.broadcast_button.show()\n else:\n status = _(\"Status: Unsigned\")\n time_str = None\n if not self.wallet.is_watching_only():\n self.sign_button.show()\n else:\n self.sign_button.hide()\n self.broadcast_button.hide()\n tx_hash = 'unknown'\n\n self.tx_hash_e.setText(tx_hash)\n self.status_label.setText(status)\n\n if time_str is not None:\n self.date_label.setText(_(\"Date: %s\")%time_str)\n self.date_label.show()\n else:\n self.date_label.hide()\n\n\n # if we are not synchronized, we cannot tell\n if self.parent.network is None or not self.parent.network.is_running() or not self.parent.network.is_connected():\n return\n if not self.wallet.up_to_date:\n return\n\n if is_relevant: \n if is_mine:\n if fee is not None: \n self.amount_label.setText(_(\"Amount sent:\")+' %s'% self.parent.format_amount(v-fee) + ' ' + self.parent.base_unit())\n self.fee_label.setText(_(\"Transaction fee\")+': %s'% self.parent.format_amount(fee) + ' ' + self.parent.base_unit())\n else:\n self.amount_label.setText(_(\"Amount sent:\")+' %s'% self.parent.format_amount(v) + ' ' + self.parent.base_unit())\n self.fee_label.setText(_(\"Transaction fee\")+': '+ _(\"unknown\"))\n else:\n self.amount_label.setText(_(\"Amount received:\")+' %s'% self.parent.format_amount(v) + ' ' + self.parent.base_unit())\n else:\n self.amount_label.setText(_(\"Transaction unrelated to your wallet\"))", "metadata": "root.TxDialog.update", "header": "['class', 'TxDialog', '(', 'QDialog', ')', ':', '___EOS___']", "index": 117 } ]
[ { "span": "tx_dict ", "start_line": 42, "start_column": 8, "end_line": 42, "end_column": 15 }, { "span": "conf ", "start_line": 136, "start_column": 16, "end_line": 136, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Tx", "Dialog_", "(_", "QD", "ial", "og_", ")_", ":_", "\\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_", ",_", "tx_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tx_", "=_", "tx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "\\u", "dict_", "=_", "tx_", "._", "as", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "=_", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wallet_", "=_", "parent_", "._", "wallet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "QD", "ial", "og_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Mini", "mum", "Width_", "(_", "600_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Window", "Title_", "(_", "\\u_", "(_", "\"", "Transa", "ction", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Modal_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "=_", "QV", "Box", "Layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Layout_", "(_", "vbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "QL", "abel_", "(_", "\\u_", "(_", "\"", "Transa", "ction", " ", "ID", ":\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tx", "\\u", "hash", "\\u", "e_", "=_", "QL", "ine", "Edit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tx", "\\u", "hash", "\\u", "e_", "._", "set", "Read", "Only_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "self_", "._", "tx", "\\u", "hash", "\\u", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status", "\\u", "label_", "=_", "QL", "abel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "self_", "._", "status", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "date", "\\u", "label_", "=_", "QL", "abel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "self_", "._", "date", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\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_", "self_", "._", "fe", "e\\u", "label_", "=_", "QL", "abel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "self_", "._", "fe", "e\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "\\u", "io_", "(_", "vbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "._", "add", "Stretch_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "buttons_", "=_", "Q", "HB", "ox", "Layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "add", "Layout_", "(_", "buttons_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "buttons_", "._", "add", "Stretch_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sign", "\\u", "button_", "=_", "b_", "=_", "QP", "ush", "Button_", "(_", "\\u_", "(_", "\"", "Sign", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "clicked_", "._", "connect_", "(_", "self_", "._", "sign_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buttons_", "._", "add", "Widget_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "broadcast", "\\u", "button_", "=_", "b_", "=_", "QP", "ush", "Button_", "(_", "\\u_", "(_", "\"", "Broad", "cast", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "clicked_", "._", "connect_", "(_", "self_", "._", "broadcast_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "hide_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buttons_", "._", "add", "Widget_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "save", "\\u", "button_", "=_", "b_", "=_", "QP", "ush", "Button_", "(_", "\\u_", "(_", "\"", "Save", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "clicked_", "._", "connect_", "(_", "self_", "._", "save_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buttons_", "._", "add", "Widget_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cancel", "Button_", "=_", "QP", "ush", "Button_", "(_", "\\u_", "(_", "\"", "Clos", "e", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cancel", "Button_", "._", "clicked_", "._", "connect_", "(_", "lambda_", ":_", "self_", "._", "done_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buttons_", "._", "add", "Widget_", "(_", "cancel", "Button_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cancel", "Button_", "._", "set", "Default_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tx", "Dialog_", "(_", "QD", "ial", "og_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "rele", "van", "t_", ",_", "is", "\\u", "mine_", ",_", "v_", ",_", "fee_", "=_", "self_", "._", "wallet_", "._", "get", "\\u", "tx", "\\u", "value_", "(_", "self_", "._", "tx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx_", "._", "is", "\\u", "complete_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "\\u_", "(_", "\"", "Status", ":", " ", "Signe", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sign", "\\u", "button_", "._", "hide_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "\\u", "hash_", "=_", "self_", "._", "tx_", "._", "hash_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tx", "\\u", "hash_", "in_", "self_", "._", "wallet_", "._", "transactions_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", ",_", "timestamp_", "=_", "self_", "._", "wallet_", "._", "verifier_", "._", "get", "\\u", "confirmation", "s_", "(_", "tx", "\\u", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "timestamp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "time", "\\u", "str_", "=_", "datetime_", "._", "datetime_", "._", "fromtimestamp_", "(_", "timestamp_", ")_", "._", "isoformat_", "(_", "'", " ", "'_", ")_", "[_", ":_", "-_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "time", "\\u", "str_", "=_", "'", "pend", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", "=_", "\\u_", "(_", "\"", "Status", ":", " ", "%", "d", " ", "confirmation", "s", "\"_", ")_", "%_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "broadcast", "\\u", "button_", "._", "hide_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "str_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "broadcast", "\\u", "button_", "._", "show_", "(_", ")_", "\\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 ", " _", "status_", "=_", "\\u_", "(_", "\"", "Status", ":", " ", "Unsigned", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time", "\\u", "str_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "wallet_", "._", "is", "\\u", "watch", "ing", "\\u", "only_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sign", "\\u", "button_", "._", "show_", "(_", ")_", "\\u\\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_", "._", "sign", "\\u", "button_", "._", "hide_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "broadcast", "\\u", "button_", "._", "hide_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "\\u", "hash_", "=_", "'", "unknown", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "tx", "\\u", "hash", "\\u", "e_", "._", "set", "Text_", "(_", "tx", "\\u", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status", "\\u", "label_", "._", "set", "Text_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "time", "\\u", "str_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "date", "\\u", "label_", "._", "set", "Text_", "(_", "\\u_", "(_", "\"", "Date", ":", " ", "%", "s", "\"_", ")_", "%_", "time", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "date", "\\u", "label_", "._", "show_", "(_", ")_", "\\u\\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_", "._", "date", "\\u", "label_", "._", "hide_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "are", " ", "not", " ", "synchronized", ",", " ", "we", " ", "cann", "ot", " ", "tell_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "network_", "is_", "None_", "or_", "not_", "self_", "._", "parent_", "._", "network_", "._", "is", "\\u", "running_", "(_", ")_", "or_", "not_", "self_", "._", "parent_", "._", "network_", "._", "is", "\\u", "connected_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "wallet_", "._", "up", "\\u", "to", "\\u", "date_", ":_", "\\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_", "is", "\\u", "rele", "van", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "mine_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fee_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "amo", "unt", "\\u", "label_", "._", "set", "Text_", "(_", "\\u_", "(_", "\"", "Amo", "unt", " ", "sent", ":\"_", ")_", "+_", "'", " ", "%", "s", "'_", "%_", "self_", "._", "parent_", "._", "format\\u", "amount_", "(_", "v_", "-_", "fee_", ")_", "+_", "'", " ", "'_", "+_", "self_", "._", "parent_", "._", "base", "\\u", "unit_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fe", "e\\u", "label_", "._", "set", "Text_", "(_", "\\u_", "(_", "\"", "Transa", "ction", " ", "fe", "e", "\"_", ")_", "+_", "':", " ", "%", "s", "'_", "%_", "self_", "._", "parent_", "._", "format\\u", "amount_", "(_", "fee_", ")_", "+_", "'", " ", "'_", "+_", "self_", "._", "parent_", "._", "base", "\\u", "unit_", "(_", ")_", ")_", "\\u\\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_", "._", "amo", "unt", "\\u", "label_", "._", "set", "Text_", "(_", "\\u_", "(_", "\"", "Amo", "unt", " ", "sent", ":\"_", ")_", "+_", "'", " ", "%", "s", "'_", "%_", "self_", "._", "parent_", "._", "format\\u", "amount_", "(_", "v_", ")_", "+_", "'", " ", "'_", "+_", "self_", "._", "parent_", "._", "base", "\\u", "unit_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fe", "e\\u", "label_", "._", "set", "Text_", "(_", "\\u_", "(_", "\"", "Transa", "ction", " ", "fe", "e", "\"_", ")_", "+_", "':", " ", "'_", "+_", "\\u_", "(_", "\"", "unknown", "\"_", ")_", ")_", "\\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_", "._", "amo", "unt", "\\u", "label_", "._", "set", "Text_", "(_", "\\u_", "(_", "\"", "Amo", "unt", " ", "receive", "d", ":\"_", ")_", "+_", "'", " ", "%", "s", "'_", "%_", "self_", "._", "parent_", "._", "format\\u", "amount_", "(_", "v_", ")_", "+_", "'", " ", "'_", "+_", "self_", "._", "parent_", "._", "base", "\\u", "unit_", "(_", ")_", ")_", "\\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_", "._", "amo", "unt", "\\u", "label_", "._", "set", "Text_", "(_", "\\u_", "(_", "\"", "Transa", "ction", " ", "unre", "late", "d", " ", "to", " ", "your", " ", "walle", "t", "\"_", ")_", ")_", "\\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, 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, 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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 ]
Unused import
GeekTrainer/Flask/Work/Trivia - Module 5/env/Lib/site-packages/werkzeug/testsuite/compat.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\n werkzeug.testsuite.compat\n ~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Ensure that old stuff does not break on update.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n\"\"\"\nimport unittest\nimport warnings\nfrom werkzeug.testsuite import WerkzeugTestCase\n\nfrom werkzeug.wrappers import Response\nfrom werkzeug.test import create_environ\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CompatTestCase(WerkzeugTestCase):\n\n", "metadata": "root.CompatTestCase", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def test_old_imports(self):\n from werkzeug.utils import Headers, MultiDict, CombinedMultiDict, \\\n Headers, EnvironHeaders\n from werkzeug.http import Accept, MIMEAccept, CharsetAccept, \\\n LanguageAccept, ETags, HeaderSet, WWWAuthenticate, \\\n Authorization", "metadata": "root.CompatTestCase.test_old_imports", "header": "['class', 'CompatTestCase', '(', 'WerkzeugTestCase', ')', ':', '___EOS___']", "index": 20 }, { "content": " def test_exposed_werkzeug_mod(self):\n import werkzeug\n for key in werkzeug.__all__:\n # deprecated, skip it\n if key in ('templates', 'Template'):\n continue\n getattr(werkzeug, key)", "metadata": "root.CompatTestCase.test_exposed_werkzeug_mod", "header": "['class', 'CompatTestCase', '(', 'WerkzeugTestCase', ')', ':', '___EOS___']", "index": 27 }, { "content": "def suite():\n suite = unittest.TestSuite()\n suite.addTest(unittest.makeSuite(CompatTestCase))\n return suite", "metadata": "root.suite", "header": "['module', '___EOS___']", "index": 36 } ]
[ { "span": "import warnings", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 15 }, { "span": "from werkzeug.wrappers import Response", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 38 }, { "span": "from werkzeug.test import create_environ", "start_line": 15, "start_column": 0, "end_line": 15, "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_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "werk", "zeu", "g", ".", "testsuite", ".", "compa", "t", "\\", "10", ";", " ", " ", " ", " ", "~~~~~~~~~~~", "~~~~~~~~~~~", "~~~", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "tha", "t", " ", "old", " ", "stu", "ff", " ", "doe", "s", " ", "not", " ", "break", " ", "on", " ", "update", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "copyr", "ight", ":", " ", "(", "c", ")", " ", "2014", " ", "by", " ", "Arm", "in", " ", "Ro", "nac", "her", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "license", ":", " ", "BS", "D", ",", " ", "see", " ", "LICENSE", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "testsuite_", "import_", "Wer", "kz", "eu", "g", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "werkzeug_", "._", "wrappers_", "import_", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "test_", "import_", "create", "\\u", "environ_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Compat", "Test", "Case_", "(_", "Wer", "kz", "eu", "g", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Compat", "Test", "Case_", "(_", "Wer", "kz", "eu", "g", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "old", "\\u", "imports_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "werkzeug_", "._", "utils_", "import_", "Headers_", ",_", "Multi", "Dict_", ",_", "Combine", "d", "Multi", "Dict_", ",_", "Headers_", ",_", "Environ", "Headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "http_", "import_", "Accept", "_", ",_", "MIME", "Accept", "_", ",_", "Charset", "Accept", "_", ",_", "Lang", "ua", "ge", "Accept", "_", ",_", "ET", "ags_", ",_", "Head", "er", "Set_", ",_", "WW", "WA", "uth", "entica", "te_", ",_", "Authorization_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compat", "Test", "Case_", "(_", "Wer", "kz", "eu", "g", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "exposed", "\\u", "werk", "zeu", "g", "\\u", "mod_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "werkzeug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "werkzeug_", "._", "\\u\\u", "all\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "depre", "cated", ",", " ", "skip", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "in_", "(_", "'", "template", "s", "'_", ",_", "'", "Templa", "te", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "getattr_", "(_", "werkzeug_", ",_", "key_", ")_", "\\u\\u\\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_", "suite_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suite_", "=_", "unittest_", "._", "Test", "Suite_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Compat", "Test", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "suite_" ]
[ 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, 0, 1, 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, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
GoogleCloudPlatform/datastore-ndb-python/ndb/eventloop_test.py
[ { "content": " def testQueueTasklet(self):\n def f(unused_number, unused_string, unused_a, unused_b): return 1\n\n def g(unused_number, unused_string): return 2\n\n def h(unused_c, unused_d): return 3\n t_before = time.time()\n eventloop.queue_call(1, f, 42, 'hello', unused_a=1, unused_b=2)\n eventloop.queue_call(3, h, unused_c=3, unused_d=4)\n eventloop.queue_call(2, g, 100, 'abc')\n t_after = time.time()\n self.assertEqual(len(self.ev.queue), 3)\n [(t1, f1, a1, k1), (t2, f2, a2, k2), (t3, f3, a3, k3)] = self.ev.queue\n self.assertTrue(t1 < t2)\n self.assertTrue(t2 < t3)\n self.assertTrue(abs(t1 - (t_before + 1)) <= t_after - t_before)\n self.assertTrue(abs(t2 - (t_before + 2)) <= t_after - t_before)\n self.assertTrue(abs(t3 - (t_before + 3)) <= t_after - t_before)\n self.assertEqual(f1, f)\n self.assertEqual(f2, g)\n self.assertEqual(f3, h)\n self.assertEqual(a1, (42, 'hello'))\n self.assertEqual(a2, (100, 'abc'))\n self.assertEqual(a3, ())\n self.assertEqual(k1, {'unused_a': 1, 'unused_b': 2})\n self.assertEqual(k2, {})\n self.assertEqual(k3, {'unused_c': 3, 'unused_d': 4})\n # Delete queued events (they would fail or take a long time).\n ev = eventloop.get_event_loop()\n ev.queue = []\n ev.rpcs = {}", "metadata": "root.EventLoopTests.testQueueTasklet", "header": "['class', 'EventLoopTests', '(', 'test_utils', '.', 'NDBTest', ')', ':', '___EOS___']", "index": 39 } ]
[ { "span": "self.assertTrue(t1 < t2)", "start_line": 52, "start_column": 4, "end_line": 52, "end_column": 28 }, { "span": "self.assertTrue(t2 < t3)", "start_line": 53, "start_column": 4, "end_line": 53, "end_column": 28 }, { "span": "self.assertTrue(abs(t1 - (t_before + 1)) <= t_after - t_before)", "start_line": 54, "start_column": 4, "end_line": 54, "end_column": 67 }, { "span": "self.assertTrue(abs(t2 - (t_before + 2)) <= t_after - t_before)", "start_line": 55, "start_column": 4, "end_line": 55, "end_column": 67 }, { "span": "self.assertTrue(abs(t3 - (t_before + 3)) <= t_after - t_before)", "start_line": 56, "start_column": 4, "end_line": 56, "end_column": 67 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Event", "Loop", "Tests_", "(_", "test\\u", "utils_", "._", "ND", "BT", "est_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test", "Queue", "Task", "let_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "f_", "(_", "unu", "sed", "\\u", "number_", ",_", "unu", "sed", "\\u", "string_", ",_", "unu", "sed", "\\u", "a_", ",_", "unu", "sed", "\\u", "b_", ")_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "g_", "(_", "unu", "sed", "\\u", "number_", ",_", "unu", "sed", "\\u", "string_", ")_", ":_", "return_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "h_", "(_", "unu", "sed", "\\u", "c_", ",_", "unu", "sed", "\\u", "d_", ")_", ":_", "return_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "before_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eventl", "oop", "_", "._", "queue", "\\u", "call_", "(_", "1_", ",_", "f_", ",_", "42_", ",_", "'", "hell", "o", "'_", ",_", "unu", "sed", "\\u", "a_", "=_", "1_", ",_", "unu", "sed", "\\u", "b_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eventl", "oop", "_", "._", "queue", "\\u", "call_", "(_", "3_", ",_", "h_", ",_", "unu", "sed", "\\u", "c_", "=_", "3_", ",_", "unu", "sed", "\\u", "d_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eventl", "oop", "_", "._", "queue", "\\u", "call_", "(_", "2_", ",_", "g_", ",_", "100_", ",_", "'", "abc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "after_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "self_", "._", "ev_", "._", "queue_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "(_", "t1_", ",_", "f1_", ",_", "a1_", ",_", "k1_", ")_", ",_", "(_", "t2_", ",_", "f2_", ",_", "a2_", ",_", "k2_", ")_", ",_", "(_", "t3_", ",_", "f3_", ",_", "a3_", ",_", "k3", "_", ")_", "]_", "=_", "self_", "._", "ev_", "._", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t1_", "<_", "t2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "t2_", "<_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "abs_", "(_", "t1_", "-_", "(_", "t", "\\u", "before_", "+_", "1_", ")_", ")_", "<=_", "t", "\\u", "after_", "-_", "t", "\\u", "before_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "abs_", "(_", "t2_", "-_", "(_", "t", "\\u", "before_", "+_", "2_", ")_", ")_", "<=_", "t", "\\u", "after_", "-_", "t", "\\u", "before_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "abs_", "(_", "t3_", "-_", "(_", "t", "\\u", "before_", "+_", "3_", ")_", ")_", "<=_", "t", "\\u", "after_", "-_", "t", "\\u", "before_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f1_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f2_", ",_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f3_", ",_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a1_", ",_", "(_", "42_", ",_", "'", "hell", "o", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a2_", ",_", "(_", "100_", ",_", "'", "abc", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a3_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "k1_", ",_", "{_", "'", "unu", "sed", "\\u", "a", "'_", ":_", "1_", ",_", "'", "unu", "sed", "\\u", "b", "'_", ":_", "2_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "k2_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "k3", "_", ",_", "{_", "'", "unu", "sed", "\\u", "c", "'_", ":_", "3_", ",_", "'", "unu", "sed", "\\u", "d", "'_", ":_", "4_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Delete", " ", "queue", "d", " ", "events", " ", "(", "the", "y", " ", "wou", "ld", " ", "fail", " ", "or", " ", "take", " ", "a", " ", "long", " ", "time", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "ev_", "=_", "eventl", "oop", "_", "._", "get", "\\u", "event", "\\u", "loop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ev_", "._", "queue_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ev_", "._", "rpc", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
First argument to super() is not enclosing class
disqus/django-db-utils/dbutils/querysets.py
[ { "content": " def __init__(self, model, step=10000, sorted=False, *args, **kwargs):\n super(SkinnyQuerySet, self).__init__(model, *args, **kwargs)\n self.step = step\n self.sorted = sorted", "metadata": "root.RangeQuerySet.__init__", "header": "['class', 'RangeQuerySet', '(', 'SkinnyQuerySet', ')', ':', '___EOS___']", "index": 82 } ]
[ { "span": "super(SkinnyQuerySet, self).", "start_line": 83, "start_column": 8, "end_line": 83, "end_column": 35 } ]
[]
1
true
[ "[CLS]_", "First_", "argument_", "to_", "super_", "(_", ")_", "is_", "not_", "encl", "osin", "g_", "class_", "[SEP]_", "class_", "Range", "Query", "Set_", "(_", "Ski", "nny", "Query", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "model_", ",_", "step_", "=_", "10000_", ",_", "sorted_", "=_", "False_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Ski", "nny", "Query", "Set_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "model_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "step_", "=_", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sorted_", "=_", "sorted_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
Esri/solutions-geoprocessing-toolbox/visibility/toolboxes/scripts/RangeRingUtils.py
[ { "content": "def rangeRingsFromList(centerFC, rangeList, distanceUnits, numRadials, outputRingFeatures, outputRadialFeatures, sr):\n ''' Make range ring features from a center, and list of distances '''\n try:\n\n if sr == \"#\" or sr == \"\" or sr == None:\n sr = srDefault\n\n rm = RingMaker(centerFC, rangeList, distanceUnits, sr)\n\n # Create Rings...\n numCenterPoints = arcpy.GetCount_management(centerFC).getOutput(0)\n numRingsPerCenter = len(rangeList)\n totalNumRings = int(numCenterPoints) * int(numRingsPerCenter)\n totalNumRadials = int(numCenterPoints) * int(numRadials)\n arcpy.AddMessage(\"Making rings \" + str(totalNumRings) + \" (\" + str(numRingsPerCenter) + \" for \" + str(numCenterPoints) + \" centers)...\")\n rm.makeRingsFromDistances()\n outRings = rm.saveRingsAsFeatures(outputRingFeatures)\n\n # Create Radials...\n arcpy.AddMessage(\"Making radials \" + str(totalNumRadials) + \" (\" + str(numRadials) + \" for \" + str(numCenterPoints) + \" centers)...\")\n rm.makeRadials(numRadials)\n outRadials = rm.saveRadialsAsFeatures(outputRadialFeatures)\n\n return [outRings, outRadials]\n except arcpy.ExecuteError:\n # Get the tool error messages\n msgs = arcpy.GetMessages()\n arcpy.AddError(msgs)\n print(msgs)\n\n except:\n # Get the traceback object\n tb = sys.exc_info()[2]\n tbinfo = traceback.format_tb(tb)[0]\n\n # Concatenate information together concerning the error into a message string\n pymsg = \"PYTHON ERRORS:\\nTraceback info:\\n\" + tbinfo + \\\n \"\\nError Info:\\n\" + str(sys.exc_info()[1])\n msgs = \"ArcPy ERRORS:\\n\" + arcpy.GetMessages() + \"\\n\"\n\n # Return python error messages for use in script tool or Python Window\n arcpy.AddError(pymsg)\n arcpy.AddError(msgs)\n # Print Python error messages for use in Python / Python Window\n print(pymsg + \"\\n\")\n print(msgs)", "metadata": "root.rangeRingsFromList", "header": "['module', '___EOS___']", "index": 41 }, { "content": " def __init__(self, center, inputRangeList, distanceUnits, sr):\n ''' initialize rings '''\n\n self.deleteme = []\n\n # project center to sr, and keep it as a list of PointGeometries object\n originalGeom = arcpy.CopyFeatures_management(center, arcpy.Geometry())\n newGeom = []\n for g in originalGeom:\n newGeom.append(g.projectAs(sr))\n self.center = newGeom\n\n self.rangeList = self._sortList(inputRangeList)\n if distanceUnits == None or distanceUnits == \"#\" or distanceUnits == \"\":\n self.distanceUnits = sr.linearUnitName\n else:\n self.distanceUnits = distanceUnits\n\n if not sr == None or not sr == \"#\" or not sr == \"\":\n self.sr = sr\n else:\n self.sr = srDefault\n\n self.ringFeatures = None\n self.radialFeatures = None\n self.ringCount = len(self.rangeList)\n self.ringMin = min(self.rangeList)\n self.ringMax = max(self.rangeList)", "metadata": "root.RingMaker.__init__", "header": "['class', 'RingMaker', ':', '___EOS___']", "index": 105 } ]
[ { "span": "sr == None:", "start_line": 45, "start_column": 36, "end_line": 45, "end_column": 46 }, { "span": "distanceUnits == None ", "start_line": 118, "start_column": 11, "end_line": 118, "end_column": 32 }, { "span": "sr == None ", "start_line": 123, "start_column": 15, "end_line": 123, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "range", "Ring", "s", "Fro", "m", "List_", "(_", "center", "FC_", ",_", "range", "List_", ",_", "distance", "Units_", ",_", "num", "Radia", "ls_", ",_", "output", "Ring", "Features_", ",_", "output", "Radia", "l", "Features_", ",_", "sr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Make", " ", "range", " ", "ring", " ", "features", " ", "from", " ", "a", " ", "center", ",", " ", "and", " ", "list", " ", "of", " ", "distance", "s", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sr_", "==_", "\"#\"_", "or_", "sr_", "==_", "\"\"_", "or_", "sr_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sr_", "=_", "sr", "Default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rm_", "=_", "Ring", "Maker_", "(_", "center", "FC_", ",_", "range", "List_", ",_", "distance", "Units_", ",_", "sr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "Ring", "s", "..._", "\\u\\u\\uNL\\u\\u\\u_", "num", "Center", "Points_", "=_", "arcpy_", "._", "Get", "Count", "\\u", "management_", "(_", "center", "FC_", ")_", "._", "get", "Output_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Ring", "s", "Per", "Center_", "=_", "len_", "(_", "range", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "Num", "Ring", "s_", "=_", "int_", "(_", "num", "Center", "Points_", ")_", "*_", "int_", "(_", "num", "Ring", "s", "Per", "Center_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "Num", "Radia", "ls_", "=_", "int_", "(_", "num", "Center", "Points_", ")_", "*_", "int_", "(_", "num", "Radia", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Maki", "ng", " ", "rings", " ", "\"_", "+_", "str_", "(_", "total", "Num", "Ring", "s_", ")_", "+_", "\"", " ", "(\"_", "+_", "str_", "(_", "num", "Ring", "s", "Per", "Center_", ")_", "+_", "\"", " ", "for", " ", "\"_", "+_", "str_", "(_", "num", "Center", "Points_", ")_", "+_", "\"", " ", "center", "s", ").", "..\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rm_", "._", "make", "Ring", "s", "Fro", "m", "Distan", "ces_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Ring", "s_", "=_", "rm_", "._", "save", "Ring", "s", "As", "Features_", "(_", "output", "Ring", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "Radia", "ls", "..._", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Maki", "ng", " ", "radial", "s", " ", "\"_", "+_", "str_", "(_", "total", "Num", "Radia", "ls_", ")_", "+_", "\"", " ", "(\"_", "+_", "str_", "(_", "num", "Radia", "ls_", ")_", "+_", "\"", " ", "for", " ", "\"_", "+_", "str_", "(_", "num", "Center", "Points_", ")_", "+_", "\"", " ", "center", "s", ").", "..\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rm_", "._", "make", "Radia", "ls_", "(_", "num", "Radia", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Radia", "ls_", "=_", "rm_", "._", "save", "Radia", "ls", "As", "Features_", "(_", "output", "Radia", "l", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "out", "Ring", "s_", ",_", "out", "Radia", "ls_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "arcpy_", "._", "Execut", "e", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "tool", " ", "error", " ", "messages_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msgs_", "=_", "arcpy_", "._", "Get", "Messages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "msgs_", ")_", "\\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_", "#", " ", "Get", " ", "the", " ", "traceback", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb", "info_", "=_", "traceback_", "._", "format\\u", "tb_", "(_", "tb_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Concat", "enat", "e", " ", "informati", "on", " ", "tog", "ether", " ", "concern", "ing", " ", "the", " ", "error", " ", "int", "o", " ", "a", " ", "message", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "pym", "sg_", "=_", "\"", "PYTHON", " ", "ERRORS", ":\\\\", "n", "Trace", "back", " ", "info", ":\\\\", "n", "\"_", "+_", "tb", "info_", "+_", "\"\\\\", "n", "Error", " ", "Info", ":\\\\", "n", "\"_", "+_", "str_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs_", "=_", "\"", "Arc", "Py", " ", "ERRORS", ":\\\\", "n", "\"_", "+_", "arcpy_", "._", "Get", "Messages_", "(_", ")_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "python", " ", "error", " ", "message", "s", " ", "for", " ", "use", " ", "in", " ", "script", " ", "tool", " ", "or", " ", "Pyth", "on", " ", "Window_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "pym", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Print", " ", "Pyth", "on", " ", "error", " ", "message", "s", " ", "for", " ", "use", " ", "in", " ", "Pyth", "on", " ", "/", " ", "Pyth", "on", " ", "Window_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "pym", "sg_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ring", "Maker_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "center_", ",_", "input", "Range", "List_", ",_", "distance", "Units_", ",_", "sr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "initialize", " ", "rings", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "delete", "me_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "project", " ", "center", " ", "to", " ", "sr", ",", " ", "and", " ", "keep", " ", "it", " ", "as", " ", "a", " ", "list", " ", "of", " ", "Point", "Geometr", "ies", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "original", "Geom_", "=_", "arcpy_", "._", "Copy", "Feature", "s", "\\u", "management_", "(_", "center_", ",_", "arcpy_", "._", "Geometry_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Geom_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "g_", "in_", "original", "Geom_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Geom_", "._", "append_", "(_", "g_", "._", "project", "As_", "(_", "sr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "center_", "=_", "new", "Geom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "range", "List_", "=_", "self_", "._", "\\u", "sort", "List_", "(_", "input", "Range", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "distance", "Units_", "==_", "None_", "or_", "distance", "Units_", "==_", "\"#\"_", "or_", "distance", "Units_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "distance", "Units_", "=_", "sr_", "._", "linear", "Unit", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "distance", "Units_", "=_", "distance", "Units_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "sr_", "==_", "None_", "or_", "not_", "sr_", "==_", "\"#\"_", "or_", "not_", "sr_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sr_", "=_", "sr_", "\\u\\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_", "._", "sr_", "=_", "sr", "Default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ring", "Features_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "radial", "Features_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ring", "Count_", "=_", "len_", "(_", "self_", "._", "range", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ring", "Min_", "=_", "min_", "(_", "self_", "._", "range", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ring", "Max_", "=_", "max_", "(_", "self_", "._", "range", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
statsmodels/statsmodels/statsmodels/sandbox/cox.py
[ { "content": "'''Cox proportional hazards regression model.\n\n\nsome dimension problems\nfixed import errors\ncurrently produces parameter estimate but then raises exception for other results\n\n\nfinally, after running the script several times, I get a OSError with too many\nopen file handles\n\nupdates and changes :\n\nas of 2010-05-15\nAttributeError: 'CoxPH' object has no attribute 'cachedir'\nTraceback (most recent call last):\n File \"C:\\...\\scikits\\statsmodels\\sandbox\\cox.py\", line 244, in <module>\n res = c.newton([0.4])\nAttributeError: 'CoxPH' object has no attribute 'newton'\n\nreplaced newton by call to new fit method for mle with bfgs\n\nfeels very slow\nneed testcase before trying to fix\n\n'''\nfrom __future__ import print_function\nfrom statsmodels.compat.python import iterkeys, range\nimport shutil\nimport tempfile\n\nimport numpy as np\n\n\nfrom statsmodels.base import model\nfrom . import survival\n\n## if dx.ndim == 1:\n## dx = dx[:,None]\n## return np.dot(dx.T, dx)\n\n\n\nif __name__ == '__main__':\n import numpy.random as R\n n = 100\n X = np.array([0]*n + [1]*n)\n b = 0.4\n lin = 1 + b*X\n Y = R.standard_exponential((2*n,)) / lin\n delta = R.binomial(1, 0.9, size=(2*n,))\n\n subjects = [Observation(Y[i], delta[i]) for i in range(2*n)]\n for i in range(2*n):\n subjects[i].X = X[i]\n\n import statsmodels.sandbox.formula as F\n x = F.Quantitative('X')\n f = F.Formula(x)\n\n c = CoxPH(subjects, f)\n\n# c.cache()\n # temp file cleanup doesn't work on windows\n c = CoxPH(subjects, f, time_dependent=True)\n c.cache() #this creates tempfile cache,\n # no tempfile cache is created in normal use of CoxPH\n\n\n #res = c.newton([0.4]) #doesn't work anymore\n res=c.fit([0.4],method=\"bfgs\")\n print(res.params)\n print(dir(c))\n #print c.fit(Y)\n #c.information(res.params) #raises exception\n\n '''\n Note: Replacement for c.newton\n\n >>> c.fit()\n Traceback (most recent call last):\n File \"<pyshell#1>\", line 1, in <module>\n c.fit()\n File \"C:\\Josef\\eclipsegworkspace\\statsmodels-josef-experimental\\scikits\\statsmodels\\model.py\", line 132, in fit\n start_params = [0]*self.exog.shape[1] # will fail for shape (K,)\n AttributeError: 'CoxPH' object has no attribute 'exog'\n >>> c.fit([0.4])\n Traceback (most recent call last):\n File \"<pyshell#2>\", line 1, in <module>\n c.fit([0.4])\n File \"C:\\Josef\\eclipsegworkspace\\statsmodels-josef-experimental\\scikits\\statsmodels\\model.py\", line 148, in fit\n H = self.hessian(history[-1])\n File \"C:\\Josef\\eclipsegworkspace\\statsmodels-josef-experimental\\scikits\\statsmodels\\model.py\", line 115, in hessian\n raise NotImplementedError\n NotImplementedError\n >>> c.fit([0.4],method=\"bfgs\")\n Optimization terminated successfully.\n Current function value: 802.354181\n Iterations: 3\n Function evaluations: 5\n Gradient evaluations: 5\n <statsmodels.model.LikelihoodModelResults object at 0x01D48B70>\n >>> res=c.fit([0.4],method=\"bfgs\")\n Optimization terminated successfully.\n Current function value: 802.354181\n Iterations: 3\n Function evaluations: 5\n Gradient evaluations: 5\n >>> res.params\n array([ 0.34924421])\n'''\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def loglike(self, b, ties='breslow'):\n\n logL = 0\n for t in iterkeys(self.failures):\n fail = self.failures[t]\n d = len(fail)\n risk = self.risk[t]\n Zb = np.dot(self.design[t], b)\n\n logL += Zb[fail].sum()\n\n if ties == 'breslow':\n s = np.exp(Zb[risk]).sum()\n logL -= np.log(np.exp(Zb[risk]).sum()) * d\n elif ties == 'efron':\n s = np.exp(Zb[risk]).sum()\n r = np.exp(Zb[fail]).sum()\n for j in range(d):\n logL -= np.log(s - j * r / d)\n elif ties == 'cox':\n raise NotImplementedError('Cox tie breaking method not \\\nimplemented')\n else:\n raise NotImplementedError('tie breaking method not recognized')\n return logL", "metadata": "root.CoxPH.loglike", "header": "['class', 'CoxPH', '(', 'model', '.', 'LikelihoodModel', ')', ':', '___EOS___']", "index": 150 } ]
[ { "span": "c ", "start_line": 252, "start_column": 4, "end_line": 252, "end_column": 5 }, { "span": "s ", "start_line": 162, "start_column": 16, "end_line": 162, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "Co", "x", " ", "proportional", " ", "hazard", "s", " ", "regress", "ion", " ", "model", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "some", " ", "dimension", " ", "problem", "s", "\\", "10", ";", "fixed", " ", "import", " ", "error", "s", "\\", "10", ";", "currentl", "y", " ", "produce", "s", " ", "parameter", " ", "estimate", " ", "but", " ", "then", " ", "raise", "s", " ", "exception", " ", "for", " ", "other", " ", "results", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "final", "ly", ",", " ", "after", " ", "runn", "ing", " ", "the", " ", "script", " ", "sever", "al", " ", "times", ",", " ", "I", " ", "get", " ", "a", " ", "OSE", "rror", " ", "with", " ", "too", " ", "many", "\\", "10", ";", "open", " ", "file", " ", "handle", "s", "\\", "10", ";", "\\", "10", ";", "update", "s", " ", "and", " ", "change", "s", " ", ":", "\\", "10", ";", "\\", "10", ";", "as", " ", "of", " ", "2010", "-0", "5", "-1", "5", "\\", "10", ";", "Attribute", "Error", ":", " ", "'", "Co", "x", "PH", "'", " ", "object", " ", "has", " ", "no", " ", "attribute", " ", "'", "cachedir", "'", "\\", "10", ";", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):", "\\", "10", ";", " ", " ", "File", " ", "\"", "C", ":\\\\", "...", "\\\\", "scikit", "s", "\\\\", "stats", "model", "s", "\\\\", "sand", "box", "\\\\", "co", "x", ".", "py", "\",", " ", "line", " ", "244", ",", " ", "in", " ", "<", "module", ">", "\\", "10", ";", " ", " ", " ", " ", "res", " ", "=", " ", "c", ".", "newton", "([", "0.", "4", "])", "\\", "10", ";", "Attribute", "Error", ":", " ", "'", "Co", "x", "PH", "'", " ", "object", " ", "has", " ", "no", " ", "attribute", " ", "'", "newton", "'", "\\", "10", ";", "\\", "10", ";", "replaced", " ", "newton", " ", "by", " ", "call", " ", "to", " ", "new", " ", "fit", " ", "method", " ", "for", " ", "mle", " ", "with", " ", "bf", "gs", "\\", "10", ";", "\\", "10", ";", "feel", "s", " ", "very", " ", "slow", "\\", "10", ";", "need", " ", "testc", "ase", " ", "bef", "ore", " ", "try", "ing", " ", "to", " ", "fix", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "stats", "models_", "._", "compat_", "._", "python_", "import_", "iterkeys_", ",_", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "stats", "models_", "._", "base_", "import_", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "surviv", "al_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", " ", " ", " ", "if", " ", "dx", ".", "ndim", " ", "==", " ", "1", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "dx", " ", "=", " ", "dx", "[:,", "Non", "e", "]_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "return", " ", "np", ".", "dot", "(", "dx", ".", "T", ",", " ", "dx", ")_", "\\u\\u\\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_", "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_", "._", "random_", "as_", "R_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "np_", "._", "array_", "(_", "[_", "0_", "]_", "*_", "n_", "+_", "[_", "1_", "]_", "*_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "0.4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lin_", "=_", "1_", "+_", "b_", "*_", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "=_", "R_", "._", "standard", "\\u", "exponential", "_", "(_", "(_", "2_", "*_", "n_", ",_", ")_", ")_", "/_", "lin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delta_", "=_", "R_", "._", "binomial", "_", "(_", "1_", ",_", "0.9_", ",_", "size_", "=_", "(_", "2_", "*_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subjects_", "=_", "[_", "Observation", "_", "(_", "Y_", "[_", "i_", "]_", ",_", "delta_", "[_", "i_", "]_", ")_", "for_", "i_", "in_", "range_", "(_", "2_", "*_", "n_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "2_", "*_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subjects_", "[_", "i_", "]_", "._", "X_", "=_", "X_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "stats", "models_", "._", "sandbox_", "._", "formula_", "as_", "F_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "F_", "._", "Quanti", "tative", "_", "(_", "'", "X", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "F_", "._", "Formula_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Co", "x", "PH", "_", "(_", "subjects_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "c", ".", "cache", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "temp", " ", "file", " ", "clean", "up", " ", "doe", "sn", "'", "t", " ", "work", " ", "on", " ", "windows_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Co", "x", "PH", "_", "(_", "subjects_", ",_", "f_", ",_", "time", "\\u", "dependent", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "cache_", "(_", ")_", "#", "this", " ", "create", "s", " ", " ", "tempfile", " ", "cache", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "tempfile", " ", "cache", " ", "is", " ", "created", " ", "in", " ", "normal", " ", "use", " ", "of", " ", "Co", "x", "PH", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "res", " ", "=", " ", "c", ".", "newton", "([", "0.", "4", "])", " ", " ", "#", "doe", "sn", "'", "t", " ", "work", " ", "any", "more_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "c_", "._", "fit_", "(_", "[_", "0.4_", "]_", ",_", "method_", "=_", "\"", "bf", "gs", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "dir_", "(_", "c_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "c", ".", "fit", "(", "Y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "c", ".", "informati", "on", "(", "res", ".", "params", ")", " ", " ", "#", "raise", "s", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ":", " ", "Replace", "ment", " ", "for", " ", "c", ".", "newton", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "c", ".", "fit", "()", "\\", "10", ";", " ", " ", " ", " ", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):", "\\", "10", ";", " ", " ", "File", " ", "\"<", "pys", "hell", "#", "1", ">\"", ",", " ", "line", " ", "1", ",", " ", "in", " ", "<", "module", ">", "\\", "10", ";", " ", " ", " ", " ", "c", ".", "fit", "()", "\\", "10", ";", " ", " ", "File", " ", "\"", "C", ":\\\\", "Jos", "ef", "\\\\", "eclipse", "gw", "ork", "space", "\\\\", "stats", "model", "s", "-", "jos", "ef", "-", "experimental", "\\\\", "scikit", "s", "\\\\", "stats", "model", "s", "\\\\", "model", ".", "py", "\",", " ", "line", " ", "132", ",", " ", "in", " ", "fit", "\\", "10", ";", " ", " ", " ", " ", "start", "\\u", "params", " ", "=", " ", "[", "0", "]*", "self", ".", "exo", "g", ".", "shape", "[", "1", "]", " ", "#", " ", "will", " ", "fail", " ", "for", " ", "shape", " ", "(", "K", ",)", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "Error", ":", " ", "'", "Co", "x", "PH", "'", " ", "object", " ", "has", " ", "no", " ", "attribute", " ", "'", "exo", "g", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "c", ".", "fit", "([", "0.", "4", "])", "\\", "10", ";", " ", " ", " ", " ", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):", "\\", "10", ";", " ", " ", "File", " ", "\"<", "pys", "hell", "#", "2", ">\"", ",", " ", "line", " ", "1", ",", " ", "in", " ", "<", "module", ">", "\\", "10", ";", " ", " ", " ", " ", "c", ".", "fit", "([", "0.", "4", "])", "\\", "10", ";", " ", " ", "File", " ", "\"", "C", ":\\\\", "Jos", "ef", "\\\\", "eclipse", "gw", "ork", "space", "\\\\", "stats", "model", "s", "-", "jos", "ef", "-", "experimental", "\\\\", "scikit", "s", "\\\\", "stats", "model", "s", "\\\\", "model", ".", "py", "\",", " ", "line", " ", "148", ",", " ", "in", " ", "fit", "\\", "10", ";", " ", " ", " ", " ", "H", " ", "=", " ", "self", ".", "hessian", "(", "histo", "ry", "[-", "1", "])", "\\", "10", ";", " ", " ", "File", " ", "\"", "C", ":\\\\", "Jos", "ef", "\\\\", "eclipse", "gw", "ork", "space", "\\\\", "stats", "model", "s", "-", "jos", "ef", "-", "experimental", "\\\\", "scikit", "s", "\\\\", "stats", "model", "s", "\\\\", "model", ".", "py", "\",", " ", "line", " ", "115", ",", " ", "in", " ", "hessian", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "Not", "Impl", "ement", "ed", "Error", "\\", "10", ";", " ", " ", " ", " ", "Not", "Impl", "ement", "ed", "Error", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "c", ".", "fit", "([", "0.", "4", "],", "method", "=\"", "bf", "gs", "\")", "\\", "10", ";", " ", " ", " ", " ", "Optim", "izatio", "n", " ", "terminate", "d", " ", "success", "full", "y", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "Curr", "ent", " ", "function", " ", "value", ":", " ", "802", ".3", "541", "8", "1", "\\", "10", ";", " ", " ", " ", " ", " ", "Iterations", ":", " ", "3", "\\", "10", ";", " ", " ", " ", " ", " ", "Function", " ", "evaluations", ":", " ", "5", "\\", "10", ";", " ", " ", " ", " ", " ", "Grad", "ient", " ", "evaluations", ":", " ", "5", "\\", "10", ";", " ", " ", " ", " ", "<", "stats", "model", "s", ".", "model", ".", "Likelihood", "Model", "Result", "s", " ", "object", " ", "at", " ", "0x01", "D4", "8", "B", "7", "0", ">", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "res", "=", "c", ".", "fit", "([", "0.", "4", "],", "method", "=\"", "bf", "gs", "\")", "\\", "10", ";", " ", " ", " ", " ", "Optim", "izatio", "n", " ", "terminate", "d", " ", "success", "full", "y", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "Curr", "ent", " ", "function", " ", "value", ":", " ", "802", ".3", "541", "8", "1", "\\", "10", ";", " ", " ", " ", " ", " ", "Iterations", ":", " ", "3", "\\", "10", ";", " ", " ", " ", " ", " ", "Function", " ", "evaluations", ":", " ", "5", "\\", "10", ";", " ", " ", " ", " ", " ", "Grad", "ient", " ", "evaluations", ":", " ", "5", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "res", ".", "params", "\\", "10", ";", " ", " ", " ", " ", "array", "([", " ", "0.34", "924", "421", "])", "\\", "10", ";'", "''_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "Co", "x", "PH", "_", "(_", "model_", "._", "Likelihood", "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_", "loglik", "e_", "(_", "self_", ",_", "b_", ",_", "ties_", "=_", "'", "bre", "slow", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "L_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", "in_", "iterkeys_", "(_", "self_", "._", "failures_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fail_", "=_", "self_", "._", "failures_", "[_", "t_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "len_", "(_", "fail_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "risk", "_", "=_", "self_", "._", "risk", "_", "[_", "t_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Zb", "_", "=_", "np_", "._", "dot_", "(_", "self_", "._", "design_", "[_", "t_", "]_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "L_", "+=_", "Zb", "_", "[_", "fail_", "]_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ties_", "==_", "'", "bre", "slow", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "np_", "._", "exp_", "(_", "Zb", "_", "[_", "risk", "_", "]_", ")_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "L_", "-=_", "np_", "._", "log_", "(_", "np_", "._", "exp_", "(_", "Zb", "_", "[_", "risk", "_", "]_", ")_", "._", "sum_", "(_", ")_", ")_", "*_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ties_", "==_", "'", "ef", "ron", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "np_", "._", "exp_", "(_", "Zb", "_", "[_", "risk", "_", "]_", ")_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "np_", "._", "exp_", "(_", "Zb", "_", "[_", "fail_", "]_", ")_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log", "L_", "-=_", "np_", "._", "log_", "(_", "s_", "-_", "j_", "*_", "r_", "/_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ties_", "==_", "'", "co", "x", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "Co", "x", " ", "tie", " ", "break", "ing", " ", "method", " ", "not", " ", "\\\\", "\\", "10", ";", "implemented", "'_", ")_", "\\u\\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_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "tie", " ", "break", "ing", " ", "method", " ", "not", " ", "recognize", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "log", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
echonest/echoprint-server/util/bigeval.py
[ { "content": "def main(argv):\n global _local_bigeval, _new_music_files\n global _new_queries, _old_queries, _total_queries\n \n single = None\n how_many = None\n start = 0\n duration = 30\n bitrate = 128\n volume = -1\n lowpass = -1\n decoder = \"mpg123\"\n encoder = \"wav\"\n local = None\n diag = False\n channels = 2\n downsample = False\n decoder = \"mpg123\"\n testfile = os.path.join(os.path.dirname(__file__), 'bigeval.json')\n newfile = \"new_music\"\n no_shuffle = False\n \n try:\n opts, args = getopt.getopt(argv, \"1:c:s:d:D:b:v:l:L:e:B:t:n:pm2h\", \n [\"single=\",\"count=\",\"start=\",\"duration=\", \"decoder=\",\"bitrate=\",\"volume=\",\"lowpass=\",\n \"encoder=\",\"print\",\"mono\",\"local=\", \"test=\", \"new=\",\"22kHz\",\"help\",\"no-shuffle\"])\n except getopt.GetoptError:\n usage()\n sys.exit(2)\n \n for opt,arg in opts:\n if opt in (\"-1\",\"--single\"):\n single = arg\n if opt in (\"-c\",\"--count\"):\n how_many = int(arg)\n if opt in (\"-s\",\"--start\"):\n start = int(arg)\n if opt in (\"-d\",\"--duration\"):\n duration = int(arg)\n if opt in (\"-D\",\"--decoder\"):\n decoder = arg\n if opt in (\"-b\",\"--bitrate\"):\n bitrate = int(arg)\n if opt in (\"-v\",\"--volume\"):\n volume = int(arg)\n if opt in (\"-l\",\"--lowpass\"):\n lowpass = int(arg)\n if opt in (\"-e\",\"--encoder\"):\n encoder = arg\n if opt in (\"-L\",\"--local\"):\n local = arg\n if opt in (\"-p\",\"--print\"):\n diag = True\n if opt in (\"-m\",\"--mono\"):\n channels = 1\n if opt in (\"-2\",\"--22kHz\"):\n downsample = True\n if opt in (\"-B\",\"--binary\"):\n if not os.path.exists(arg):\n print \"Binary %s not found. Exiting.\" % arg\n sys.exit(2)\n config.CODEGEN_BINARY_OVERRIDE = arg\n if opt in (\"-n\",\"--new\"):\n newfile = arg\n if opt in (\"-t\",\"--test\"):\n testfile = arg\n if opt == \"--no-shuffle\":\n no_shuffle = True\n if opt in (\"-h\",\"--help\"):\n usage()\n sys.exit(2)\n \n if (single is None) and (how_many is None):\n print >>sys.stderr, \"Run in single mode (-1) or say how many files to test (-c)\"\n usage()\n sys.exit(2)\n \n if testfile.lower() == \"none\" and newfile.lower() == \"none\" and single is None:\n # If both are none, we can't run\n print >>sys.stderr, \"Can't run with no datafiles. Skip --test, --new or add -1\"\n sys.exit(2)\n if testfile.lower() == \"none\":\n _local_bigeval = {}\n else:\n if not os.path.exists(testfile):\n print >>sys.stderr, \"Cannot find bigeval.json. did you run fastingest with the -b flag?\"\n sys.exit(1)\n _local_bigeval = json.load(open(testfile,'r'))\n if newfile.lower() == \"none\" or not os.path.exists(newfile):\n _new_music_files = []\n else:\n _new_music_files = open(newfile,'r').read().split('\\n')\n\n _new_queries = float(len(_new_music_files))\n _old_queries = float(len(_local_bigeval.keys()))\n _total_queries = _new_queries + _old_queries\n \n if local is None:\n local = False\n else:\n # ingest\n codes = json.load(open(local,'r'))\n _reversed_bigeval = dict( (_local_bigeval[k], k) for k in _local_bigeval)\n code_dict = {}\n tids = {}\n for c in codes:\n fn = c[\"metadata\"][\"filename\"]\n tid = _reversed_bigeval.get(fn, None)\n tids[tid] = True\n if tid is not None:\n if c.has_key(\"code\"):\n if len(c[\"code\"]) > 4:\n code_dict[tid] = fp.decode_code_string(c[\"code\"])\n \n fp.ingest(code_dict, local=True)\n lp = {}\n for r in _local_bigeval.keys():\n if tids.has_key(r):\n lp[r] = _local_bigeval[r]\n _local_bigeval = lp\n local = True\n \n if single is not None:\n test_single(single, local=local, start=start, duration = duration, bitrate = bitrate, volume = volume, lowpass_freq = lowpass, encode_to=encoder, downsample_to_22 = downsample, channels = channels)\n else:\n results = test(how_many, diag = diag, local=local, no_shuffle=no_shuffle, start=start, duration = duration, bitrate = bitrate, volume = volume, lowpass_freq = lowpass, encode_to=encoder, downsample_to_22 = downsample, channels = channels)\n prf(results)\n dpwe(results)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 373 } ]
[ { "span": "decoder ", "start_line": 384, "start_column": 4, "end_line": 384, "end_column": 11 }, { "span": "decoder ", "start_line": 390, "start_column": 4, "end_line": 390, "end_column": 11 } ]
[ { "span": "decoder ", "start_line": 413, "start_column": 12, "end_line": 413, "end_column": 19 } ]
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_", "main_", "(_", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "\\u", "local", "\\u", "big", "eval_", ",_", "\\u", "new", "\\u", "music", "\\u", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "\\u", "new", "\\u", "queries_", ",_", "\\u", "old", "\\u", "queries_", ",_", "\\u", "total", "\\u", "queries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "single_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "how", "\\u", "many_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bitrate_", "=_", "128_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "volume_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "low", "pass_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decoder_", "=_", "\"", "mpg", "123", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encoder_", "=_", "\"", "wav", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diag_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channels_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "downsample", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decoder_", "=_", "\"", "mpg", "123", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "big", "eval", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newfile", "_", "=_", "\"", "new", "\\u", "music", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "\\u", "shuffle_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", ",_", "args_", "=_", "getopt_", "._", "getopt_", "(_", "argv_", ",_", "\"", "1", ":", "c", ":", "s", ":", "d", ":", "D", ":", "b", ":", "v", ":", "l", ":", "L", ":", "e", ":", "B", ":", "t", ":", "n", ":", "pm", "2h", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "single", "=\"_", ",_", "\"", "count", "=\"_", ",_", "\"", "start", "=\"_", ",_", "\"", "duration", "=\"_", ",_", "\"", "decode", "r", "=\"_", ",_", "\"", "bit", "rate", "=\"_", ",_", "\"", "volume", "=\"_", ",_", "\"", "low", "pass", "=\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "encode", "r", "=\"_", ",_", "\"", "print", "\"_", ",_", "\"", "mono", "\"_", ",_", "\"", "local", "=\"_", ",_", "\"", "test", "=\"_", ",_", "\"", "new", "=\"_", ",_", "\"", "2", "2", "k", "H", "z", "\"_", ",_", "\"", "help", "\"_", ",_", "\"", "no", "-", "shu", "ffle", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "getopt_", "._", "Get", "opt", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "usage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "opt_", ",_", "arg_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opt_", "in_", "(_", "\"-", "1", "\"_", ",_", "\"--", "single", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "single_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "c", "\"_", ",_", "\"--", "count", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "how", "\\u", "many_", "=_", "int_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "s", "\"_", ",_", "\"--", "start", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "int_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "d", "\"_", ",_", "\"--", "duration", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "duration_", "=_", "int_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "D", "\"_", ",_", "\"--", "decode", "r", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "decoder_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "b", "\"_", ",_", "\"--", "bit", "rate", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bitrate_", "=_", "int_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "v", "\"_", ",_", "\"--", "volume", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "volume_", "=_", "int_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "l", "\"_", ",_", "\"--", "low", "pass", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "low", "pass_", "=_", "int_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "e", "\"_", ",_", "\"--", "encode", "r", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encoder_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "L", "\"_", ",_", "\"--", "local", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "p", "\"_", ",_", "\"--", "print", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diag_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "m", "\"_", ",_", "\"--", "mono", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "channels_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "2", "\"_", ",_", "\"--", "2", "2", "k", "H", "z", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "downsample", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "B", "\"_", ",_", "\"--", "binar", "y", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Bin", "ary", " ", "%", "s", " ", "not", " ", "found", ".", " ", "Exi", "ting", ".\"_", "%_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "._", "CODE", "GEN", "\\u", "BIN", "ARY", "\\u", "OVERRIDE", "_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "n", "\"_", ",_", "\"--", "new", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newfile", "_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "t", "\"_", ",_", "\"--", "test", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testfile_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "==_", "\"--", "no", "-", "shu", "ffle", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "no", "\\u", "shuffle_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "in_", "(_", "\"-", "h", "\"_", ",_", "\"--", "help", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "usage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "single_", "is_", "None_", ")_", "and_", "(_", "how", "\\u", "many_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"", "Run", " ", "in", " ", "single", " ", "mode", " ", "(-", "1", ")", " ", "or", " ", "say", " ", "how", " ", "many", " ", "files", " ", "to", " ", "test", " ", "(-", "c", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "testfile_", "._", "lower_", "(_", ")_", "==_", "\"", "none", "\"_", "and_", "newfile", "_", "._", "lower_", "(_", ")_", "==_", "\"", "none", "\"_", "and_", "single_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "bot", "h", " ", "are", " ", "none", ",", " ", "we", " ", "can", "'", "t", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"", "Can", "'", "t", " ", "run", " ", "with", " ", "no", " ", "datafile", "s", ".", " ", "Ski", "p", " ", "--", "test", ",", " ", "--", "new", " ", "or", " ", "add", " ", "-1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "testfile_", "._", "lower_", "(_", ")_", "==_", "\"", "none", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "local", "\\u", "big", "eval_", "=_", "{_", "}_", "\\u\\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_", "os_", "._", "path_", "._", "exists_", "(_", "testfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"", "Cann", "ot", " ", "find", " ", "big", "eval", ".", "json", ".", " ", "did", " ", "you", " ", "run", " ", "fast", "ingest", " ", "with", " ", "the", " ", "-", "b", " ", "flag", "?\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "local", "\\u", "big", "eval_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "testfile_", ",_", "'", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "newfile", "_", "._", "lower_", "(_", ")_", "==_", "\"", "none", "\"_", "or_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "newfile", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "new", "\\u", "music", "\\u", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "new", "\\u", "music", "\\u", "files_", "=_", "open_", "(_", "newfile", "_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "new", "\\u", "queries_", "=_", "float_", "(_", "len_", "(_", "\\u", "new", "\\u", "music", "\\u", "files_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "old", "\\u", "queries_", "=_", "float_", "(_", "len_", "(_", "\\u", "local", "\\u", "big", "eval_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "total", "\\u", "queries_", "=_", "\\u", "new", "\\u", "queries_", "+_", "\\u", "old", "\\u", "queries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "local_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ingest", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "codes_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "local_", ",_", "'", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "reverse", "d\\u", "big", "eval_", "=_", "dict_", "(_", "(_", "\\u", "local", "\\u", "big", "eval_", "[_", "k_", "]_", ",_", "k_", ")_", "for_", "k_", "in_", "\\u", "local", "\\u", "big", "eval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tid", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "codes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fn_", "=_", "c_", "[_", "\"", "metadata", "\"_", "]_", "[_", "\"", "filename", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tid_", "=_", "\\u", "reverse", "d\\u", "big", "eval_", "._", "get_", "(_", "fn_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tid", "s_", "[_", "tid_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tid_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "c_", "._", "has", "\\u", "key_", "(_", "\"", "code", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "len_", "(_", "c_", "[_", "\"", "code", "\"_", "]_", ")_", ">_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "code", "\\u", "dict_", "[_", "tid_", "]_", "=_", "fp_", "._", "decode", "\\u", "code", "\\u", "string_", "(_", "c_", "[_", "\"", "code", "\"_", "]_", ")_", "\\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_", "fp_", "._", "ingest", "_", "(_", "code", "\\u", "dict_", ",_", "local_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lp_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "\\u", "local", "\\u", "big", "eval_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tid", "s_", "._", "has", "\\u", "key_", "(_", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lp_", "[_", "r_", "]_", "=_", "\\u", "local", "\\u", "big", "eval_", "[_", "r_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "local", "\\u", "big", "eval_", "=_", "lp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "single_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "single_", "(_", "single_", ",_", "local_", "=_", "local_", ",_", "start_", "=_", "start_", ",_", "duration_", "=_", "duration_", ",_", "bitrate_", "=_", "bitrate_", ",_", "volume_", "=_", "volume_", ",_", "low", "pass", "\\u", "freq_", "=_", "low", "pass_", ",_", "encode", "\\u", "to_", "=_", "encoder_", ",_", "downsample", "\\u", "to", "\\u", "22_", "=_", "downsample", "_", ",_", "channels_", "=_", "channels_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "test_", "(_", "how", "\\u", "many_", ",_", "diag_", "=_", "diag_", ",_", "local_", "=_", "local_", ",_", "no", "\\u", "shuffle_", "=_", "no", "\\u", "shuffle_", ",_", "start_", "=_", "start_", ",_", "duration_", "=_", "duration_", ",_", "bitrate_", "=_", "bitrate_", ",_", "volume_", "=_", "volume_", ",_", "low", "pass", "\\u", "freq_", "=_", "low", "pass_", ",_", "encode", "\\u", "to_", "=_", "encoder_", ",_", "downsample", "\\u", "to", "\\u", "22_", "=_", "downsample", "_", ",_", "channels_", "=_", "channels_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prf", "_", "(_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dp", "we", "_", "(_", "results_", ")_", "\\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, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ccollins/milkman/docs/conf.py
[ { "content": "# -*- coding: utf-8 -*-\nimport sys, os\nsys.path.append(\"../\")\n\nextensions = []\ntemplates_path = ['_templates']\nsource_suffix = '.txt'\nmaster_doc = 'index'\n\nproject = 'milkman'\ncopyright = '2011'\nversion = '4.5'\nrelease = '4.5'\n\ntoday_fmt = '%B %d, %Y'\nexclude_trees = []\npygments_style = 'sphinx'\nhtml_style = 'default.css'\nhtml_static_path = ['_static']\nhtml_last_updated_fmt = '%b %d, %Y'\n\nhtmlhelp_basename = 'milkmandoc'\nlatex_documents = [\n ('index', 'milkman.tex', 'Milkman Documentation',\n '', 'manual'),\n]\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys, os", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "\"..", "/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "s", "\\u", "path_", "=_", "[_", "'\\u", "template", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "suffix_", "=_", "'.", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "master", "\\u", "doc_", "=_", "'", "index", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "'", "mil", "kma", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "'", "2011", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "'", "4.5", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "release_", "=_", "'", "4.5", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "toda", "y", "\\u", "fmt_", "=_", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclu", "de", "\\u", "trees_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "ment", "s", "\\u", "style_", "=_", "'", "sphinx", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "\\u", "style_", "=_", "'", "default", ".", "css", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "\\u", "static", "\\u", "path_", "=_", "[_", "'\\u", "static", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "\\u", "last", "\\u", "update", "d\\u", "fmt_", "=_", "'%", "b", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html", "help", "\\u", "basename_", "=_", "'", "mil", "kma", "ndo", "c", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "mil", "kma", "n", ".", "tex", "'_", ",_", "'", "Mil", "kma", "n", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "manu", "al", "'_", ")_", ",_", "\\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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
statsmodels/statsmodels/statsmodels/sandbox/tsa/examples/ex_mle_arma.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\nTODO: broken because of changes to arguments and import paths\nfixing this needs a closer look\n\nCreated on Thu Feb 11 23:41:53 2010\nAuthor: josef-pktd\ncopyright: Simplified BSD see license.txt\n\"\"\"\nfrom __future__ import print_function\nimport numpy as np\nfrom numpy.testing import assert_almost_equal\n\nimport matplotlib.pyplot as plt\n\nimport numdifftools as ndt\n\nimport statsmodels.api as sm\nfrom statsmodels.sandbox import tsa\nfrom statsmodels.tsa.arma_mle import Arma # local import\nfrom statsmodels.tsa.arima_process import arma_generate_sample\n\nexamples = ['arma']\nif 'arma' in examples:\n\n print(\"\\nExample 1\")\n print('----------')\n ar = [1.0, -0.8]\n ma = [1.0, 0.5]\n y1 = arma_generate_sample(ar,ma,1000,0.1)\n y1 -= y1.mean() #no mean correction/constant in estimation so far\n\n arma1 = Arma(y1)\n arma1.nar = 1\n arma1.nma = 1\n arma1res = arma1.fit_mle(order=(1,1), method='fmin')\n print(arma1res.params)\n\n #Warning need new instance otherwise results carry over\n arma2 = Arma(y1)\n arma2.nar = 1\n arma2.nma = 1\n res2 = arma2.fit(method='bfgs')\n print(res2.params)\n print(res2.model.hessian(res2.params))\n print(ndt.Hessian(arma1.loglike, stepMax=1e-2)(res2.params))\n arest = tsa.arima.ARIMA(y1)\n resls = arest.fit((1,0,1))\n print(resls[0])\n print(resls[1])\n\n\n\n print('\\nparameter estimate - comparing methods')\n print('---------------------------------------')\n print('parameter of DGP ar(1), ma(1), sigma_error')\n print([-0.8, 0.5, 0.1])\n print('mle with fmin')\n print(arma1res.params)\n print('mle with bfgs')\n print(res2.params)\n print('cond. least squares uses optim.leastsq ?')\n errls = arest.error_estimate\n print(resls[0], np.sqrt(np.dot(errls,errls)/errls.shape[0]))\n\n err = arma1.geterrors(res2.params)\n print('cond least squares parameter cov')\n #print(np.dot(err,err)/err.shape[0] * resls[1])\n #errls = arest.error_estimate\n print(np.dot(errls,errls)/errls.shape[0] * resls[1])\n# print('fmin hessian')\n# print(arma1res.model.optimresults['Hopt'][:2,:2])\n print('bfgs hessian')\n print(res2.model.optimresults['Hopt'][:2,:2])\n print('numdifftools inverse hessian')\n print(-np.linalg.inv(ndt.Hessian(arma1.loglike, stepMax=1e-2)(res2.params))[:2,:2])\n\n print('\\nFitting Arma(1,1) to squared data')\n arma3 = Arma(y1**2)\n res3 = arma3.fit(method='bfgs')\n print(res3.params)\n\n print('\\nFitting Arma(3,3) to data from DGP Arma(1,1)')\n arma4 = Arma(y1)\n arma4.nar = 3\n arma4.nma = 3\n #res4 = arma4.fit(method='bfgs')\n res4 = arma4.fit(start_params=[-0.5, -0.1,-0.1,0.2,0.1,0.1,0.5])\n print(res4.params)\n print('numdifftools inverse hessian')\n pcov = -np.linalg.inv(ndt.Hessian(arma4.loglike, stepMax=1e-2)(res4.params))\n #print(pcov)\n print('standard error of parameter estimate from Hessian')\n pstd = np.sqrt(np.diag(pcov))\n print(pstd)\n print('t-values')\n print(res4.params/pstd)\n print('eigenvalues of pcov:')\n print(np.linalg.eigh(pcov)[0])\n print('sometimes they are negative')\n\n\n print(\"\\nExample 2 - DGP is Arma(3,3)\")\n print('-----------------------------')\n ar = [1.0, -0.6, -0.2, -0.1]\n ma = [1.0, 0.5, 0.1, 0.1]\n y2 = arest.generate_sample(ar,ma,1000,0.1)\n y2 -= y2.mean() #no mean correction/constant in estimation so far\n\n\n print('\\nFitting Arma(3,3) to data from DGP Arma(3,3)')\n arma4 = Arma(y2)\n arma4.nar = 3\n arma4.nma = 3\n #res4 = arma4.fit(method='bfgs')\n print('\\ntrue parameters')\n print('ar', ar[1:])\n print('ma', ma[1:])\n res4 = arma4.fit(start_params=[-0.5, -0.1,-0.1,0.2,0.1,0.1,0.5])\n print(res4.params)\n print('numdifftools inverse hessian')\n pcov = -np.linalg.inv(ndt.Hessian(arma4.loglike, stepMax=1e-2)(res4.params))\n #print(pcov)\n print('standard error of parameter estimate from Hessian')\n pstd = np.sqrt(np.diag(pcov))\n print(pstd)\n print('t-values')\n print(res4.params/pstd)\n print('eigenvalues of pcov:')\n print(np.linalg.eigh(pcov)[0])\n print('sometimes they are negative')\n\n arma6 = Arma(y2)\n arma6.nar = 3\n arma6.nma = 3\n res6 = arma6.fit(start_params=[-0.5, -0.1,-0.1,0.2,0.1,0.1,0.5],\n method='bfgs')\n print('\\nmle with bfgs')\n print(res6.params)\n print('pstd with bfgs hessian')\n hopt = res6.model.optimresults['Hopt']\n print(np.sqrt(np.diag(hopt)))\n\n #fmin estimates for coefficients in ARMA(3,3) look good\n #but not inverse Hessian, sometimes negative values for variance\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from numpy.testing import assert_almost_equal", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 45 }, { "span": "import matplotlib.pyplot as plt", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 31 }, { "span": "import statsmodels.api as sm", "start_line": 17, "start_column": 0, "end_line": 17, "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_", "\"\"\"", "\\", "10", ";", "TOD", "O", ":", " ", "broken", " ", "bec", "aus", "e", " ", "of", " ", "change", "s", " ", "to", " ", "argu", "ment", "s", " ", "and", " ", "import", " ", "path", "s", "\\", "10", ";", "fix", "ing", " ", "this", " ", "need", "s", " ", "a", " ", "close", "r", " ", "look", "\\", "10", ";", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "Thu", " ", "Fe", "b", " ", "11", " ", "23", ":", "4", "1", ":", "5", "3", " ", "2010", "\\", "10", ";", "Author", ":", " ", "jos", "ef", "-", "pkt", "d", "\\", "10", ";", "copyr", "ight", ":", " ", "Simplif", "ied", " ", "BS", "D", " ", "see", " ", "license", ".", "txt", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "testing_", "import_", "assert", "\\u", "alm", "ost", "\\u", "equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "num", "diff", "tools_", "as_", "ndt", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "stats", "models_", "._", "api_", "as_", "sm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "stats", "models_", "._", "sandbox_", "import_", "tsa", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "stats", "models_", "._", "tsa", "_", "._", "arma", "\\u", "mle", "_", "import_", "Arm", "a_", "#", " ", "local", " ", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "stats", "models_", "._", "tsa", "_", "._", "ari", "ma", "\\u", "process_", "import_", "arma", "\\u", "generat", "e\\u", "sample_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "examples_", "=_", "[_", "'", "arma", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "arma", "'_", "in_", "examples_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"\\\\", "n", "Exam", "ple", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'-------", "---", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ar_", "=_", "[_", "1.0_", ",_", "-_", "0.8_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ma_", "=_", "[_", "1.0_", ",_", "0.5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y1_", "=_", "arma", "\\u", "generat", "e\\u", "sample_", "(_", "ar_", ",_", "ma_", ",_", "1000_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y1_", "-=_", "y1_", "._", "mean_", "(_", ")_", "#", "no", " ", "mean", " ", "correcti", "on", "/", "constant", " ", "in", " ", "estimati", "on", " ", "so", " ", "far_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arma", "1_", "=_", "Arm", "a_", "(_", "y1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arma", "1_", "._", "nar", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arma", "1_", "._", "nma", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arma", "1", "res_", "=_", "arma", "1_", "._", "fit", "\\u", "mle", "_", "(_", "order_", "=_", "(_", "1_", ",_", "1_", ")_", ",_", "method_", "=_", "'", "fmin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "arma", "1", "res_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Warn", "ing", " ", "need", " ", "new", " ", "instance", " ", "other", "wis", "e", " ", "results", " ", "carry", " ", "over_", "\\u\\u\\uNL\\u\\u\\u_", "arma", "2_", "=_", "Arm", "a_", "(_", "y1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arma", "2_", "._", "nar", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arma", "2_", "._", "nma", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res2_", "=_", "arma", "2_", "._", "fit_", "(_", "method_", "=_", "'", "bf", "gs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res2_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res2_", "._", "model_", "._", "hessian", "_", "(_", "res2_", "._", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "ndt", "_", "._", "Hes", "sia", "n_", "(_", "arma", "1_", "._", "loglik", "e_", ",_", "step", "Max_", "=_", "1e-2_", ")_", "(_", "res2_", "._", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ares", "t_", "=_", "tsa", "_", "._", "ari", "ma_", "._", "ARI", "MA_", "(_", "y1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "ls_", "=_", "ares", "t_", "._", "fit_", "(_", "(_", "1_", ",_", "0_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "ls_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "ls_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'\\\\", "npar", "amet", "er", " ", "estimate", " ", "-", " ", "compa", "ring", " ", "method", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'-------", "--------------", "--------------", "----", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "parameter", " ", "of", " ", "DG", "P", " ", "ar", "(", "1", "),", " ", "ma", "(", "1", "),", " ", "sigma", "\\u", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "[_", "-_", "0.8_", ",_", "0.5_", ",_", "0.1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "mle", " ", "with", " ", "fmin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "arma", "1", "res_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "mle", " ", "with", " ", "bf", "gs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res2_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "cond", ".", " ", "leas", "t", " ", "square", "s", " ", "use", "s", " ", "optim", ".", "leas", "ts", "q", " ", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "ls_", "=_", "ares", "t_", "._", "error", "\\u", "estimate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "ls_", "[_", "0_", "]_", ",_", "np_", "._", "sqrt_", "(_", "np_", "._", "dot_", "(_", "err", "ls_", ",_", "err", "ls_", ")_", "/_", "err", "ls_", "._", "shape_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "err_", "=_", "arma", "1_", "._", "gete", "rror", "s_", "(_", "res2_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "cond", " ", "leas", "t", " ", "square", "s", " ", "parameter", " ", "cov", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "(", "np", ".", "dot", "(", "err", ",", "err", ")/", "err", ".", "shape", "[", "0", "]", " ", "*", " ", "res", "ls", "[", "1", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "err", "ls", " ", "=", " ", "ares", "t", ".", "error", "\\u", "estimate_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "np_", "._", "dot_", "(_", "err", "ls_", ",_", "err", "ls_", ")_", "/_", "err", "ls_", "._", "shape_", "[_", "0_", "]_", "*_", "res", "ls_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", "('", "fmin", " ", "hessian", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", "(", "arma", "1", "res", ".", "model", ".", "optim", "results", "['", "Hop", "t", "']", "[:", "2", ",:", "2", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "bf", "gs", " ", "hessian", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res2_", "._", "model_", "._", "optim", "results_", "[_", "'", "Hop", "t", "'_", "]_", "[_", ":_", "2_", ",_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "num", "diff", "tool", "s", " ", "inv", "erse", " ", "hessian", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "-_", "np_", "._", "linalg_", "._", "inv_", "(_", "ndt", "_", "._", "Hes", "sia", "n_", "(_", "arma", "1_", "._", "loglik", "e_", ",_", "step", "Max_", "=_", "1e-2_", ")_", "(_", "res2_", "._", "params_", ")_", ")_", "[_", ":_", "2_", ",_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'\\\\", "n", "Fitt", "ing", " ", "Arm", "a", "(", "1", ",", "1", ")", " ", "to", " ", "square", "d", " ", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arma", "3_", "=_", "Arm", "a_", "(_", "y1_", "**_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "3_", "=_", "arma", "3_", "._", "fit_", "(_", "method_", "=_", "'", "bf", "gs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "3_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'\\\\", "n", "Fitt", "ing", " ", "Arm", "a", "(", "3", ",", "3", ")", " ", "to", " ", "data", " ", "from", " ", "DG", "P", " ", "Arm", "a", "(", "1", ",", "1", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arma", "4_", "=_", "Arm", "a_", "(_", "y1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arma", "4_", "._", "nar", "_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arma", "4_", "._", "nma", "_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "res", "4", " ", "=", " ", "arma", "4", ".", "fit", "(", "method", "='", "bf", "gs", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "res", "4_", "=_", "arma", "4_", "._", "fit_", "(_", "start", "\\u", "params_", "=_", "[_", "-_", "0.5_", ",_", "-_", "0.1_", ",_", "-_", "0.1_", ",_", "0.2_", ",_", "0.1_", ",_", "0.1_", ",_", "0.5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "4_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "num", "diff", "tool", "s", " ", "inv", "erse", " ", "hessian", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pco", "v_", "=_", "-_", "np_", "._", "linalg_", "._", "inv_", "(_", "ndt", "_", "._", "Hes", "sia", "n_", "(_", "arma", "4_", "._", "loglik", "e_", ",_", "step", "Max_", "=_", "1e-2_", ")_", "(_", "res", "4_", "._", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "(", "pco", "v", ")_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "standard", " ", "error", " ", "of", " ", "parameter", " ", "estimate", " ", "from", " ", "Hes", "sia", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pst", "d_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "diag_", "(_", "pco", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "pst", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "t", "-", "values", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "4_", "._", "params_", "/_", "pst", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "eigenvalues", " ", "of", " ", "pco", "v", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "np_", "._", "linalg_", "._", "eig", "h_", "(_", "pco", "v_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "somet", "imes", " ", "the", "y", " ", "are", " ", "negati", "ve", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "n", "Exam", "ple", " ", "2", " ", "-", " ", "DG", "P", " ", "is", " ", "Arm", "a", "(", "3", ",", "3", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'-------", "--------------", "--------", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ar_", "=_", "[_", "1.0_", ",_", "-_", "0.6_", ",_", "-_", "0.2_", ",_", "-_", "0.1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ma_", "=_", "[_", "1.0_", ",_", "0.5_", ",_", "0.1_", ",_", "0.1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y2_", "=_", "ares", "t_", "._", "generat", "e\\u", "sample_", "(_", "ar_", ",_", "ma_", ",_", "1000_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y2_", "-=_", "y2_", "._", "mean_", "(_", ")_", "#", "no", " ", "mean", " ", "correcti", "on", "/", "constant", " ", "in", " ", "estimati", "on", " ", "so", " ", "far_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'\\\\", "n", "Fitt", "ing", " ", "Arm", "a", "(", "3", ",", "3", ")", " ", "to", " ", "data", " ", "from", " ", "DG", "P", " ", "Arm", "a", "(", "3", ",", "3", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arma", "4_", "=_", "Arm", "a_", "(_", "y2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arma", "4_", "._", "nar", "_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arma", "4_", "._", "nma", "_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "res", "4", " ", "=", " ", "arma", "4", ".", "fit", "(", "method", "='", "bf", "gs", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'\\\\", "ntr", "ue", " ", "parameter", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "ar", "'_", ",_", "ar_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "ma", "'_", ",_", "ma_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "4_", "=_", "arma", "4_", "._", "fit_", "(_", "start", "\\u", "params_", "=_", "[_", "-_", "0.5_", ",_", "-_", "0.1_", ",_", "-_", "0.1_", ",_", "0.2_", ",_", "0.1_", ",_", "0.1_", ",_", "0.5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "4_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "num", "diff", "tool", "s", " ", "inv", "erse", " ", "hessian", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pco", "v_", "=_", "-_", "np_", "._", "linalg_", "._", "inv_", "(_", "ndt", "_", "._", "Hes", "sia", "n_", "(_", "arma", "4_", "._", "loglik", "e_", ",_", "step", "Max_", "=_", "1e-2_", ")_", "(_", "res", "4_", "._", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "(", "pco", "v", ")_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "standard", " ", "error", " ", "of", " ", "parameter", " ", "estimate", " ", "from", " ", "Hes", "sia", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pst", "d_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "diag_", "(_", "pco", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "pst", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "t", "-", "values", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "4_", "._", "params_", "/_", "pst", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "eigenvalues", " ", "of", " ", "pco", "v", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "np_", "._", "linalg_", "._", "eig", "h_", "(_", "pco", "v_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "somet", "imes", " ", "the", "y", " ", "are", " ", "negati", "ve", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arma", "6_", "=_", "Arm", "a_", "(_", "y2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arma", "6_", "._", "nar", "_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arma", "6_", "._", "nma", "_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "6_", "=_", "arma", "6_", "._", "fit_", "(_", "start", "\\u", "params_", "=_", "[_", "-_", "0.5_", ",_", "-_", "0.1_", ",_", "-_", "0.1_", ",_", "0.2_", ",_", "0.1_", ",_", "0.1_", ",_", "0.5_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "bf", "gs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'\\\\", "nm", "le", " ", "with", " ", "bf", "gs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "6_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "pst", "d", " ", "with", " ", "bf", "gs", " ", "hessian", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hop", "t_", "=_", "res", "6_", "._", "model_", "._", "optim", "results_", "[_", "'", "Hop", "t", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "np_", "._", "sqrt_", "(_", "np_", "._", "diag_", "(_", "hop", "t_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "fmin", " ", "estimate", "s", " ", "for", " ", "coefficient", "s", " ", "in", " ", "ARM", "A", "(", "3", ",", "3", ")", " ", "look", " ", "good_", "\\u\\u\\uNL\\u\\u\\u_", "#", "but", " ", "not", " ", "inv", "erse", " ", "Hes", "sia", "n", ",", " ", "somet", "imes", " ", "negati", "ve", " ", "values", " ", "for", " ", "variance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
First parameter of a method is not named 'self'
CollabQ/CollabQ/appengine_django/models.py
[ { "content": " def __init__(cls, name, bases, attrs):\n \"\"\"Initialises the list of Django properties.\n\n This method takes care of wrapping the properties created by the superclass\n so that they look like Django properties and installing them into the\n ._meta object of the class so that Django can find them at the appropriate\n time.\n \"\"\"\n super(PropertiedClassWithDjango, cls).__init__(name, bases, attrs)\n if name == 'BaseModel':\n # This metaclass only acts on subclasses of BaseModel.\n return\n\n fields = [PropertyWrapper(p) for p in cls._properties.values()]\n cls._meta.local_fields = fields", "metadata": "root.PropertiedClassWithDjango.__init__", "header": "['class', 'PropertiedClassWithDjango', '(', 'db', '.', 'PropertiedClass', ')', ':', '___EOS___']", "index": 123 } ]
[ { "span": "def __init__(cls, name, bases, attrs):", "start_line": 123, "start_column": 2, "end_line": 123, "end_column": 40 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Proper", "tied", "Class", "With", "Dj", "ang", "o_", "(_", "db_", "._", "Proper", "tied", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "cls_", ",_", "name_", ",_", "bases_", ",_", "attrs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initialise", "s", " ", "the", " ", "list", " ", "of", " ", "Dj", "ang", "o", " ", "proper", "ties", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "take", "s", " ", "care", " ", "of", " ", "wrapp", "ing", " ", "the", " ", "proper", "ties", " ", "created", " ", "by", " ", "the", " ", "superclass", "\\", "10", ";", " ", " ", " ", " ", "so", " ", "tha", "t", " ", "the", "y", " ", "look", " ", "like", " ", "Dj", "ang", "o", " ", "proper", "ties", " ", "and", " ", "install", "ing", " ", "them", " ", "int", "o", " ", "the", "\\", "10", ";", " ", " ", " ", " ", ".\\u", "meta", " ", "object", " ", "of", " ", "the", " ", "class", " ", "so", " ", "tha", "t", " ", "Dj", "ang", "o", " ", "can", " ", "find", " ", "them", " ", "at", " ", "the", " ", "appropr", "iate", "\\", "10", ";", " ", " ", " ", " ", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Proper", "tied", "Class", "With", "Dj", "ang", "o_", ",_", "cls_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "name_", ",_", "bases_", ",_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "==_", "'", "Base", "Model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "metaclass", " ", "only", " ", "acts", " ", "on", " ", "subclasses", " ", "of", " ", "Base", "Model", "._", "\\u\\u\\uNL\\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_", "fields_", "=_", "[_", "Proper", "ty", "Wrapper_", "(_", "p_", ")_", "for_", "p_", "in_", "cls_", "._", "\\u", "properties_", "._", "values_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "\\u", "meta_", "._", "local", "\\u", "fields_", "=_", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
echonest/pyechonest/pyechonest/proxies.py
[ { "content": " def __init__(self, identifier, type, buckets = None, **kwargs):\n super(CatalogProxy, self).__init__()\n buckets = buckets or []\n self.id = identifier\n self._object_type = 'catalog'\n kwargs = dict((str(k), v) for (k,v) in kwargs.iteritems())\n # the following are integral to all catalog objects... the rest is up to you!\n core_attrs = ['name']\n if not all(ca in kwargs for ca in core_attrs):\n if util.short_regex.match(self.id) or util.long_regex.match(self.id) or util.foreign_regex.match(self.id):\n profile = self.get_attribute('profile')\n kwargs.update(profile['catalog'])\n else:\n if not type:\n raise Exception('You must specify a \"type\"!')\n try:\n profile = self.get_attribute('profile')\n existing_type = profile['catalog'].get('type', 'Unknown')\n if type != existing_type:\n raise Exception(\"Catalog type requested (%s) does not match existing catalog type (%s)\" % (type, existing_type))\n \n kwargs.update(profile['catalog'])\n except util.EchoNestAPIError:\n profile = self.post_attribute('create', type=type, **kwargs)\n kwargs.update(profile)\n [self.__dict__.update({ca:kwargs.pop(ca)}) for ca in core_attrs+['id'] if ca in kwargs]\n self.cache.update(kwargs)", "metadata": "root.CatalogProxy.__init__", "header": "['class', 'CatalogProxy', '(', 'GenericProxy', ')', ':', '___EOS___']", "index": 56 } ]
[ { "span": "buckets ", "start_line": 58, "start_column": 8, "end_line": 58, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Catalog", "Proxy_", "(_", "Gene", "ric", "Proxy_", ")_", ":_", "\\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_", ",_", "identifier_", ",_", "type_", ",_", "buckets_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Catalog", "Proxy_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buckets_", "=_", "buckets_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "id_", "=_", "identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "object\\u", "type_", "=_", "'", "catal", "og", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "dict_", "(_", "(_", "str_", "(_", "k_", ")_", ",_", "v_", ")_", "for_", "(_", "k_", ",_", "v_", ")_", "in_", "kwargs_", "._", "iteritems_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "follow", "ing", " ", "are", " ", "integral", " ", "to", " ", "all", " ", "catal", "og", " ", "object", "s", "...", " ", "the", " ", "rest", " ", "is", " ", "up", " ", "to", " ", "you", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "core", "\\u", "attrs_", "=_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "all_", "(_", "ca_", "in_", "kwargs_", "for_", "ca_", "in_", "core", "\\u", "attrs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "util_", "._", "short", "\\u", "regex_", "._", "match_", "(_", "self_", "._", "id_", ")_", "or_", "util_", "._", "long", "\\u", "regex_", "._", "match_", "(_", "self_", "._", "id_", ")_", "or_", "util_", "._", "foreign", "\\u", "regex_", "._", "match_", "(_", "self_", "._", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "profile_", "=_", "self_", "._", "get", "\\u", "attribute_", "(_", "'", "profile", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "profile_", "[_", "'", "catal", "og", "'_", "]_", ")_", "\\u\\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_", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Exception_", "(_", "'", "You", " ", "must", " ", "speci", "fy", " ", "a", " ", "\"", "type", "\"!", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "profile_", "=_", "self_", "._", "get", "\\u", "attribute_", "(_", "'", "profile", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "type_", "=_", "profile_", "[_", "'", "catal", "og", "'_", "]_", "._", "get_", "(_", "'", "type", "'_", ",_", "'", "Un", "know", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "!=_", "exist", "ing", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Exception_", "(_", "\"", "Catalog", " ", "type", " ", "request", "ed", " ", "(%", "s", ")", " ", "doe", "s", " ", "not", " ", "match", " ", "exist", "ing", " ", "catal", "og", " ", "type", " ", "(%", "s", ")\"_", "%_", "(_", "type_", ",_", "exist", "ing", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "profile_", "[_", "'", "catal", "og", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "util_", "._", "Ech", "o", "Nest", "API", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "profile_", "=_", "self_", "._", "post", "\\u", "attribute_", "(_", "'", "create", "'_", ",_", "type_", "=_", "type_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "update_", "(_", "{_", "ca_", ":_", "kwargs_", "._", "pop_", "(_", "ca_", ")_", "}_", ")_", "for_", "ca_", "in_", "core", "\\u", "attrs_", "+_", "[_", "'", "id", "'_", "]_", "if_", "ca_", "in_", "kwargs_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cache_", "._", "update_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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2, 2, 2 ]
Modification of parameter with default
Sage-Bionetworks/synapsePythonClient/synapseutils/copy.py
[ { "content": "def _getSubWikiHeaders(wikiHeaders,subPageId,mapping=[]):\n subPageId = str(subPageId)\n for i in wikiHeaders:\n # This is for the first match \n # If it isnt the actual parent, it will turn the first match into a parent node which will not have a parentId\n if i['id'] == subPageId and len(mapping) == 0:\n i.pop(\"parentId\",None)\n mapping.append(i)\n #If a mapping already exists, it means that these pages have a parent node\n elif i['id'] == subPageId:\n mapping.append(i)\n #If parentId is not None, and if parent id is the subpage Id, pass it back into the function\n elif i.get('parentId',None) is not None:\n if i['parentId'] == subPageId:\n mapping = _getSubWikiHeaders(wikiHeaders,subPageId=i['id'],mapping=mapping)\n return(mapping)", "metadata": "root._getSubWikiHeaders", "header": "['module', '___EOS___']", "index": 264 } ]
[ { "span": "mapping.", "start_line": 274, "start_column": 12, "end_line": 274, "end_column": 19 } ]
[ { "span": "mapping=", "start_line": 264, "start_column": 45, "end_line": 264, "end_column": 52 } ]
1
true
[ "[CLS]_", "Modifica", "tion_", "of_", "parameter_", "with_", "default_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "Sub", "Wiki", "Headers_", "(_", "wiki", "Headers_", ",_", "sub", "Page", "Id_", ",_", "mapping_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub", "Page", "Id_", "=_", "str_", "(_", "sub", "Page", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "wiki", "Headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "for", " ", "the", " ", "first", " ", "match", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "it", " ", "isn", "t", " ", "the", " ", "actual", " ", "parent", ",", " ", "it", " ", "will", " ", "turn", " ", "the", " ", "first", " ", "match", " ", "int", "o", " ", "a", " ", "parent", " ", "node", " ", "whi", "ch", " ", "will", " ", "not", " ", "have", " ", "a", " ", "parent", "Id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "[_", "'", "id", "'_", "]_", "==_", "sub", "Page", "Id_", "and_", "len_", "(_", "mapping_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "._", "pop_", "(_", "\"", "parent", "Id", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapping_", "._", "append_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "If", " ", "a", " ", "mapping", " ", "alr", "ead", "y", " ", "exist", "s", ",", " ", "it", " ", "means", " ", "tha", "t", " ", "these", " ", "page", "s", " ", "have", " ", "a", " ", "parent", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", "[_", "'", "id", "'_", "]_", "==_", "sub", "Page", "Id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mapping_", "._", "append_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "If", " ", "parent", "Id", " ", "is", " ", "not", " ", "Non", "e", ",", " ", "and", " ", "if", " ", "parent", " ", "id", " ", "is", " ", "the", " ", "subpa", "ge", " ", "Id", ",", " ", "pass", " ", "it", " ", "back", " ", "int", "o", " ", "the", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", "._", "get_", "(_", "'", "parent", "Id", "'_", ",_", "None_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "[_", "'", "parent", "Id", "'_", "]_", "==_", "sub", "Page", "Id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mapping_", "=_", "\\u", "get", "Sub", "Wiki", "Headers_", "(_", "wiki", "Headers_", ",_", "sub", "Page", "Id_", "=_", "i_", "[_", "'", "id", "'_", "]_", ",_", "mapping_", "=_", "mapping_", ")_", "\\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_", "(_", "mapping_", ")_", "\\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, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
christabor/MoAL/MOAL/data_structures/linear/array/suffix_arrays.py
[ { "content": "# -*- coding: utf-8 -*-\n\n__author__ = \"\"\"Chris Tabor ([email protected])\"\"\"\n\nif __name__ == '__main__':\n from os import getcwd\n from os import sys\n sys.path.append(getcwd())\n\nfrom MOAL.helpers.display import Section\nfrom MOAL.helpers.display import prnt\nfrom MOAL.helpers.text import words_unix_dict\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n with Section('Suffix Array'):\n DEBUG = False\n\n word_gen = words_unix_dict()\n\n iarray = InfixArray()\n iarray.make_superstring(strings=[word_gen.next() for _ in range(2)])\n\n prnt('Weird infix style substring', iarray)\n\n ssarray = SuperSuffixArray()\n ssarray.make_superstring(strings=[word_gen.next() for _ in range(10)])\n\n prnt('Superstring suffix array', ssarray, func=repr)\n\n ssarray.sort()\n\n prnt('SORTED Superstring suffix array', ssarray, func=repr)\n\n if DEBUG:\n ssarray2 = SuperSuffixArray()\n ssarray2.make_superstring(\n strings=['pneumonoultramicroscopicsilicovolcanoconiosis'])\n\n prnt('Superstring suffix array - long', ssarray2, func=repr)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "ssarray2 = SuperSuffixArray()", "start_line": 110, "start_column": 12, "end_line": 110, "end_column": 41 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"\"\"", "Chr", "is", " ", "Tab", "or", " ", "(", "dx", "dst", "udio", "@", "gma", "il", ".", "com", ")\"\"\"_", "\\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 ", " _", "from_", "os_", "import_", "getcwd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "getcwd_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "MO", "AL_", "._", "helpers_", "._", "display_", "import_", "Section_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "MO", "AL_", "._", "helpers_", "._", "display_", "import_", "prn", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "MO", "AL_", "._", "helpers_", "._", "text_", "import_", "words", "\\u", "unix", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\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 ", " _", "with_", "Section_", "(_", "'", "Su", "ffi", "x", " ", "Array", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DEBUG_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "word", "\\u", "gen_", "=_", "words", "\\u", "unix", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "iar", "ray_", "=_", "Inf", "ix", "Array_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iar", "ray_", "._", "make", "\\u", "supers", "tring_", "(_", "strings_", "=_", "[_", "word", "\\u", "gen_", "._", "next_", "(_", ")_", "for_", "\\u_", "in_", "range_", "(_", "2_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prn", "t_", "(_", "'", "Wei", "rd", " ", "infix", " ", "style", " ", "substring", "'_", ",_", "iar", "ray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ssa", "rray_", "=_", "Super", "Su", "ffi", "x", "Array_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssa", "rray_", "._", "make", "\\u", "supers", "tring_", "(_", "strings_", "=_", "[_", "word", "\\u", "gen_", "._", "next_", "(_", ")_", "for_", "\\u_", "in_", "range_", "(_", "10_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prn", "t_", "(_", "'", "Super", "string", " ", "suff", "ix", " ", "array", "'_", ",_", "ssa", "rray_", ",_", "func_", "=_", "repr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ssa", "rray_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prn", "t_", "(_", "'", "SORT", "ED", " ", "Super", "string", " ", "suff", "ix", " ", "array", "'_", ",_", "ssa", "rray_", ",_", "func_", "=_", "repr_", ")_", "\\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 ", " _", "ssa", "rray", "2_", "=_", "Super", "Su", "ffi", "x", "Array_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssa", "rray", "2_", "._", "make", "\\u", "supers", "tring_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "strings_", "=_", "[_", "'", "pne", "um", "ono", "ultr", "ami", "cro", "scop", "ics", "ili", "cov", "ol", "can", "oco", "nio", "sis", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prn", "t_", "(_", "'", "Super", "string", " ", "suff", "ix", " ", "array", " ", "-", " ", "long", "'_", ",_", "ssa", "rray", "2_", ",_", "func_", "=_", "repr_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Use of the return value of a procedure
OpenBazaar/OpenBazaar-Server/market/network.py
[ { "content": " def open_dispute(self, order_id, claim):\n \"\"\"\n Given and order ID we will pull the contract from disk and send it along with the claim\n to both the moderator and other party to the dispute. If either party isn't online we will stick\n it in the DHT for them.\n \"\"\"\n try:\n file_path = os.path.join(DATA_FOLDER, \"purchases\", \"in progress\", order_id + \".json\")\n with open(file_path, 'r') as filename:\n contract = json.load(filename, object_pairs_hook=OrderedDict)\n guid = contract[\"vendor_offer\"][\"listing\"][\"id\"][\"guid\"]\n handle = \"\"\n if \"blockchain_id\" in contract[\"vendor_offer\"][\"listing\"][\"id\"]:\n handle = contract[\"vendor_offer\"][\"listing\"][\"id\"][\"blockchain_id\"]\n guid_key = contract[\"vendor_offer\"][\"listing\"][\"id\"][\"pubkeys\"][\"guid\"]\n proof_sig = self.db.purchases.get_proof_sig(order_id)\n except Exception:\n try:\n file_path = os.path.join(DATA_FOLDER, \"store\", \"contracts\", \"in progress\", order_id + \".json\")\n with open(file_path, 'r') as filename:\n contract = json.load(filename, object_pairs_hook=OrderedDict)\n guid = contract[\"buyer_order\"][\"order\"][\"id\"][\"guid\"]\n handle = \"\"\n if \"blockchain_id\" in contract[\"buyer_order\"][\"order\"][\"id\"]:\n handle = contract[\"buyer_order\"][\"order\"][\"id\"][\"blockchain_id\"]\n guid_key = contract[\"buyer_order\"][\"order\"][\"id\"][\"pubkeys\"][\"guid\"]\n proof_sig = None\n except Exception:\n return False\n\n if \"dispute\" not in contract:\n keychain = KeyChain(self.db)\n contract[\"dispute\"] = {}\n contract[\"dispute\"][\"info\"] = {}\n contract[\"dispute\"][\"info\"][\"claim\"] = claim\n contract[\"dispute\"][\"info\"][\"guid\"] = keychain.guid.encode(\"hex\")\n contract[\"dispute\"][\"info\"][\"avatar_hash\"] = Profile(self.db).get().avatar_hash.encode(\"hex\")\n if proof_sig:\n contract[\"dispute\"][\"info\"][\"proof_sig\"] = base64.b64encode(proof_sig)\n info = json.dumps(contract[\"dispute\"][\"info\"], indent=4)\n contract[\"dispute\"][\"signature\"] = base64.b64encode(keychain.signing_key.sign(info)[:64])\n with open(file_path, 'wb') as outfile:\n outfile.write(json.dumps(contract, indent=4))\n\n if self.db.purchases.get_purchase(order_id) is not None:\n self.db.purchases.update_status(order_id, 4)\n\n elif self.db.sales.get_sale(order_id) is not None:\n self.db.sales.update_status(order_id, 4)\n\n avatar_hash = Profile(self.db).get().avatar_hash\n\n self.db.messages.save_message(guid, handle, \"\", order_id, \"DISPUTE_OPEN\",\n claim, time.time(), avatar_hash, \"\", True)\n\n mod_guid = contract[\"buyer_order\"][\"order\"][\"moderator\"]\n for mod in contract[\"vendor_offer\"][\"listing\"][\"moderators\"]:\n if mod[\"guid\"] == mod_guid:\n mod_key = mod[\"pubkeys\"][\"guid\"]\n\n def get_node(node_to_ask, recipient_guid, public_key):\n def parse_response(response):\n if not response[0]:\n self.send_message(Node(unhexlify(recipient_guid)),\n nacl.signing.VerifyKey(\n public_key,\n encoder=nacl.encoding.HexEncoder).to_curve25519_public_key().encode(),\n objects.PlaintextMessage.Type.Value(\"DISPUTE_OPEN\"),\n json.dumps(contract),\n order_id,\n store_only=True)\n\n if node_to_ask:\n enc_key = nacl.signing.VerifyKey(\n public_key, encoder=nacl.encoding.HexEncoder).to_curve25519_public_key()\n skephem = PrivateKey.generate()\n pkephem = skephem.public_key.encode(nacl.encoding.RawEncoder)\n box = Box(skephem, enc_key)\n nonce = nacl.utils.random(Box.NONCE_SIZE)\n ciphertext = box.encrypt(json.dumps(contract, indent=4), nonce)\n d = self.protocol.callDisputeOpen(node_to_ask, pkephem, ciphertext)\n return d.addCallback(parse_response)\n else:\n return parse_response([False])\n\n self.kserver.resolve(unhexlify(guid)).addCallback(get_node, guid, guid_key)\n self.kserver.resolve(unhexlify(mod_guid)).addCallback(get_node, mod_guid, mod_key)", "metadata": "root.Server.open_dispute", "header": "['class', 'Server', '(', 'object', ')', ':', '___EOS___']", "index": 701 } ]
[ { "span": "parse_response([False])", "start_line": 784, "start_column": 23, "end_line": 784, "end_column": 46 } ]
[ { "span": "def parse_response(response):", "start_line": 762, "start_column": 12, "end_line": 762, "end_column": 41 } ]
1
false
[ "[CLS]_", "Use_", "of_", "the_", "return_", "value_", "of_", "a_", "procedure_", "[SEP]_", "class_", "Server_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open", "\\u", "disp", "ute", "_", "(_", "self_", ",_", "order", "\\u", "id_", ",_", "claim_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "and", " ", "order", " ", "ID", " ", "we", " ", "will", " ", "pull", " ", "the", " ", "contract", " ", "from", " ", "disk", " ", "and", " ", "send", " ", "it", " ", "along", " ", "with", " ", "the", " ", "claim", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "bot", "h", " ", "the", " ", "moderator", " ", "and", " ", "other", " ", "part", "y", " ", "to", " ", "the", " ", "disp", "ute", ".", " ", "If", " ", "eit", "her", " ", "part", "y", " ", "isn", "'", "t", " ", "onli", "ne", " ", "we", " ", "will", " ", "stick", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "in", " ", "the", " ", "DH", "T", " ", "for", " ", "them", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "DATA", "\\u", "FOLDER_", ",_", "\"", "purchase", "s", "\"_", ",_", "\"", "in", " ", "progress", "\"_", ",_", "order", "\\u", "id_", "+_", "\".", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "file", "\\u", "path_", ",_", "'", "r", "'_", ")_", "as_", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contract_", "=_", "json_", "._", "load_", "(_", "filename_", ",_", "object\\u", "pair", "s", "\\u", "hook_", "=_", "Order", "ed", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guid_", "=_", "contract_", "[_", "\"", "vendor", "\\u", "off", "er", "\"_", "]_", "[_", "\"", "listi", "ng", "\"_", "]_", "[_", "\"", "id", "\"_", "]_", "[_", "\"", "guid", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "blockchain", "\\u", "id", "\"_", "in_", "contract_", "[_", "\"", "vendor", "\\u", "off", "er", "\"_", "]_", "[_", "\"", "listi", "ng", "\"_", "]_", "[_", "\"", "id", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "handle_", "=_", "contract_", "[_", "\"", "vendor", "\\u", "off", "er", "\"_", "]_", "[_", "\"", "listi", "ng", "\"_", "]_", "[_", "\"", "id", "\"_", "]_", "[_", "\"", "blockchain", "\\u", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "guid", "\\u", "key_", "=_", "contract_", "[_", "\"", "vendor", "\\u", "off", "er", "\"_", "]_", "[_", "\"", "listi", "ng", "\"_", "]_", "[_", "\"", "id", "\"_", "]_", "[_", "\"", "pubkey", "s", "\"_", "]_", "[_", "\"", "guid", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proof", "\\u", "sig_", "=_", "self_", "._", "db_", "._", "purchase", "s_", "._", "get", "\\u", "proof", "\\u", "sig_", "(_", "order", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "DATA", "\\u", "FOLDER_", ",_", "\"", "store", "\"_", ",_", "\"", "contracts", "\"_", ",_", "\"", "in", " ", "progress", "\"_", ",_", "order", "\\u", "id_", "+_", "\".", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "file", "\\u", "path_", ",_", "'", "r", "'_", ")_", "as_", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "contract_", "=_", "json_", "._", "load_", "(_", "filename_", ",_", "object\\u", "pair", "s", "\\u", "hook_", "=_", "Order", "ed", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guid_", "=_", "contract_", "[_", "\"", "buyer", "\\u", "order", "\"_", "]_", "[_", "\"", "order", "\"_", "]_", "[_", "\"", "id", "\"_", "]_", "[_", "\"", "guid", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "blockchain", "\\u", "id", "\"_", "in_", "contract_", "[_", "\"", "buyer", "\\u", "order", "\"_", "]_", "[_", "\"", "order", "\"_", "]_", "[_", "\"", "id", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "handle_", "=_", "contract_", "[_", "\"", "buyer", "\\u", "order", "\"_", "]_", "[_", "\"", "order", "\"_", "]_", "[_", "\"", "id", "\"_", "]_", "[_", "\"", "blockchain", "\\u", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "guid", "\\u", "key_", "=_", "contract_", "[_", "\"", "buyer", "\\u", "order", "\"_", "]_", "[_", "\"", "order", "\"_", "]_", "[_", "\"", "id", "\"_", "]_", "[_", "\"", "pubkey", "s", "\"_", "]_", "[_", "\"", "guid", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proof", "\\u", "sig_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "disp", "ute", "\"_", "not_", "in_", "contract_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keyc", "hain", "_", "=_", "Key", "Chain_", "(_", "self_", "._", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contract_", "[_", "\"", "disp", "ute", "\"_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contract_", "[_", "\"", "disp", "ute", "\"_", "]_", "[_", "\"", "info", "\"_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contract_", "[_", "\"", "disp", "ute", "\"_", "]_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "claim", "\"_", "]_", "=_", "claim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contract_", "[_", "\"", "disp", "ute", "\"_", "]_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "guid", "\"_", "]_", "=_", "keyc", "hain", "_", "._", "guid_", "._", "encode_", "(_", "\"", "hex", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contract_", "[_", "\"", "disp", "ute", "\"_", "]_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "avat", "ar", "\\u", "hash", "\"_", "]_", "=_", "Profile_", "(_", "self_", "._", "db_", ")_", "._", "get_", "(_", ")_", "._", "avat", "ar", "\\u", "hash_", "._", "encode_", "(_", "\"", "hex", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "proof", "\\u", "sig_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contract_", "[_", "\"", "disp", "ute", "\"_", "]_", "[_", "\"", "info", "\"_", "]_", "[_", "\"", "proof", "\\u", "sig", "\"_", "]_", "=_", "base64_", "._", "b64encode_", "(_", "proof", "\\u", "sig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info_", "=_", "json_", "._", "dumps_", "(_", "contract_", "[_", "\"", "disp", "ute", "\"_", "]_", "[_", "\"", "info", "\"_", "]_", ",_", "indent_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contract_", "[_", "\"", "disp", "ute", "\"_", "]_", "[_", "\"", "signa", "ture", "\"_", "]_", "=_", "base64_", "._", "b64encode_", "(_", "keyc", "hain", "_", "._", "signin", "g", "\\u", "key_", "._", "sign_", "(_", "info_", ")_", "[_", ":_", "64_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "file", "\\u", "path_", ",_", "'", "wb", "'_", ")_", "as_", "outfile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outfile_", "._", "write_", "(_", "json_", "._", "dumps_", "(_", "contract_", ",_", "indent_", "=_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "db_", "._", "purchase", "s_", "._", "get", "\\u", "purchase", "_", "(_", "order", "\\u", "id_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db_", "._", "purchase", "s_", "._", "update", "\\u", "status_", "(_", "order", "\\u", "id_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "db_", "._", "sales", "_", "._", "get", "\\u", "sale_", "(_", "order", "\\u", "id_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db_", "._", "sales", "_", "._", "update", "\\u", "status_", "(_", "order", "\\u", "id_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "avat", "ar", "\\u", "hash_", "=_", "Profile_", "(_", "self_", "._", "db_", ")_", "._", "get_", "(_", ")_", "._", "avat", "ar", "\\u", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "db_", "._", "messages_", "._", "save", "\\u", "message_", "(_", "guid_", ",_", "handle_", ",_", "\"\"_", ",_", "order", "\\u", "id_", ",_", "\"", "DISP", "UT", "E", "\\u", "OPEN", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "claim_", ",_", "time_", "._", "time_", "(_", ")_", ",_", "avat", "ar", "\\u", "hash_", ",_", "\"\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mod", "\\u", "guid_", "=_", "contract_", "[_", "\"", "buyer", "\\u", "order", "\"_", "]_", "[_", "\"", "order", "\"_", "]_", "[_", "\"", "moderator", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "contract_", "[_", "\"", "vendor", "\\u", "off", "er", "\"_", "]_", "[_", "\"", "listi", "ng", "\"_", "]_", "[_", "\"", "moderator", "s", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "mod_", "[_", "\"", "guid", "\"_", "]_", "==_", "mod", "\\u", "guid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod", "\\u", "key_", "=_", "mod_", "[_", "\"", "pubkey", "s", "\"_", "]_", "[_", "\"", "guid", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "node_", "(_", "node", "\\u", "to", "\\u", "ask_", ",_", "recip", "ient", "\\u", "guid_", ",_", "public", "\\u", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "parse", "\\u", "response_", "(_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "response_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "send", "\\u", "message_", "(_", "Node_", "(_", "unhexlify_", "(_", "recip", "ient", "\\u", "guid_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nac", "l_", "._", "signin", "g_", "._", "Verify", "Key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "public", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encoder_", "=_", "nac", "l_", "._", "encoding_", "._", "Hex", "Encoder_", ")_", "._", "to", "\\u", "curve", "2551", "9", "\\u", "public", "\\u", "key_", "(_", ")_", "._", "encode_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "objects_", "._", "Plai", "ntext", "Message_", "._", "Type_", "._", "Value_", "(_", "\"", "DISP", "UT", "E", "\\u", "OPEN", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "._", "dumps_", "(_", "contract_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "order", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "store", "\\u", "only_", "=_", "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_", "node", "\\u", "to", "\\u", "ask_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enc", "\\u", "key_", "=_", "nac", "l_", "._", "signin", "g_", "._", "Verify", "Key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "public", "\\u", "key_", ",_", "encoder_", "=_", "nac", "l_", "._", "encoding_", "._", "Hex", "Encoder_", ")_", "._", "to", "\\u", "curve", "2551", "9", "\\u", "public", "\\u", "key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ske", "phe", "m_", "=_", "Priva", "te", "Key_", "._", "generate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pk", "ephem", "_", "=_", "ske", "phe", "m_", "._", "public", "\\u", "key_", "._", "encode_", "(_", "nac", "l_", "._", "encoding_", "._", "Ra", "w", "Encoder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "box_", "=_", "Box_", "(_", "ske", "phe", "m_", ",_", "enc", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nonce_", "=_", "nac", "l_", "._", "utils_", "._", "random_", "(_", "Box_", "._", "NON", "CE", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ciphertext_", "=_", "box_", "._", "encrypt_", "(_", "json_", "._", "dumps_", "(_", "contract_", ",_", "indent_", "=_", "4_", ")_", ",_", "nonce_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "protocol_", "._", "call", "Disp", "ute", "Open_", "(_", "node", "\\u", "to", "\\u", "ask_", ",_", "pk", "ephem", "_", ",_", "ciphertext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "._", "add", "Callback_", "(_", "parse", "\\u", "response_", ")_", "\\u\\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_", "parse", "\\u", "response_", "(_", "[_", "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_", "self_", "._", "kse", "rver_", "._", "resolve_", "(_", "unhexlify_", "(_", "guid_", ")_", ")_", "._", "add", "Callback_", "(_", "get", "\\u", "node_", ",_", "guid_", ",_", "guid", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "kse", "rver_", "._", "resolve_", "(_", "unhexlify_", "(_", "mod", "\\u", "guid_", ")_", ")_", "._", "add", "Callback_", "(_", "get", "\\u", "node_", ",_", "mod", "\\u", "guid_", ",_", "mod", "\\u", "key_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Except block handles 'BaseException'
sivel/github-notify/github-notify.py
[ { "content": "def get_config():\n config_files = (\n './github-notify.yaml',\n os.path.expanduser('~/.github-notify.yaml'),\n '/etc/github-notify.yaml'\n )\n for config_file in config_files:\n try:\n with open(os.path.realpath(config_file)) as f:\n config = yaml.load(f)\n except:\n pass\n else:\n return config\n\n raise SystemExit('Config file not found at: %s' % ', '.join(config_files))", "metadata": "root.get_config", "header": "['module', '___EOS___']", "index": 26 } ]
[ { "span": "except:", "start_line": 36, "start_column": 8, "end_line": 36, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "config_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "files_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'./", "git", "hub", "-", "notif", "y", ".", "yaml", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/.", "git", "hub", "-", "notif", "y", ".", "yaml", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "etc", "/", "git", "hub", "-", "notif", "y", ".", "yaml", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "config", "\\u", "file_", "in_", "config", "\\u", "files_", ":_", "\\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 ", " _", "with_", "open_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "config", "\\u", "file_", ")_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "=_", "yaml_", "._", "load_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "config_", "\\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_", "System", "Exit_", "(_", "'", "Config", " ", "file", " ", "not", " ", "found", " ", "at", ":", " ", "%", "s", "'_", "%_", "',", " ", "'_", "._", "join_", "(_", "config", "\\u", "files_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 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 ]
Except block handles 'BaseException'
nlloyd/SubliminalCollaborator/libs/twisted/web/xmlrpc.py
[ { "content": " def _cbRender(self, result, request, responseFailed=None):\n if responseFailed:\n return\n\n if isinstance(result, Handler):\n result = result.result\n if not isinstance(result, Fault):\n result = (result,)\n try:\n try:\n content = xmlrpclib.dumps(\n result, methodresponse=True,\n allow_none=self.allowNone)\n except Exception, e:\n f = Fault(self.FAILURE, \"Can't serialize output: %s\" % (e,))\n content = xmlrpclib.dumps(f, methodresponse=True,\n allow_none=self.allowNone)\n\n request.setHeader(\"content-length\", str(len(content)))\n request.write(content)\n except:\n log.err()\n request.finish()", "metadata": "root.XMLRPC._cbRender", "header": "['class', 'XMLRPC', '(', 'resource', '.', 'Resource', ')', ':', '___EOS___']", "index": 177 }, { "content": " def parseResponse(self, contents):\n if not self.deferred:\n return\n try:\n if self.useDateTime:\n response = xmlrpclib.loads(contents,\n use_datetime=True)[0][0]\n else:\n # Maintain backwards compatibility with Python < 2.5\n response = xmlrpclib.loads(contents)[0][0]\n except:\n deferred, self.deferred = self.deferred, None\n deferred.errback(failure.Failure())\n else:\n deferred, self.deferred = self.deferred, None\n deferred.callback(response)", "metadata": "root._QueryFactory.parseResponse", "header": "['class', '_QueryFactory', '(', 'protocol', '.', 'ClientFactory', ')', ':', '___EOS___']", "index": 434 }, { "content": " def __init__(self, url, user=None, password=None, allowNone=False,\n useDateTime=False, connectTimeout=30.0, reactor=reactor):\n \"\"\"\n @param url: The URL to which to post method calls. Calls will be made\n over SSL if the scheme is HTTPS. If netloc contains username or\n password information, these will be used to authenticate, as long as\n the C{user} and C{password} arguments are not specified.\n @type url: C{str}\n\n \"\"\"\n scheme, netloc, path, params, query, fragment = urlparse.urlparse(url)\n netlocParts = netloc.split('@')\n if len(netlocParts) == 2:\n userpass = netlocParts.pop(0).split(':')\n self.user = userpass.pop(0)\n try:\n self.password = userpass.pop(0)\n except:\n self.password = None\n else:\n self.user = self.password = None\n hostport = netlocParts[0].split(':')\n self.host = hostport.pop(0)\n try:\n self.port = int(hostport.pop(0))\n except:\n self.port = None\n self.path = path\n if self.path in ['', None]:\n self.path = '/'\n self.secure = (scheme == 'https')\n if user is not None:\n self.user = user\n if password is not None:\n self.password = password\n self.allowNone = allowNone\n self.useDateTime = useDateTime\n self.connectTimeout = connectTimeout\n self._reactor = reactor", "metadata": "root.Proxy.__init__", "header": "['class', 'Proxy', ':', '___EOS___']", "index": 506 } ]
[ { "span": "except:", "start_line": 197, "start_column": 8, "end_line": 197, "end_column": 15 }, { "span": "except:", "start_line": 444, "start_column": 8, "end_line": 444, "end_column": 15 }, { "span": "except:", "start_line": 523, "start_column": 12, "end_line": 523, "end_column": 19 }, { "span": "except:", "start_line": 531, "start_column": 8, "end_line": 531, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "XMLRPC", "_", "(_", "resource_", "._", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "cb", "Render_", "(_", "self_", ",_", "result_", ",_", "request_", ",_", "response", "Failed_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "response", "Failed_", ":_", "\\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_", "(_", "result_", ",_", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "result_", "._", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "result_", ",_", "Fault_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "(_", "result_", ",_", ")_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "xmlrpclib_", "._", "dumps_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "result_", ",_", "method", "response_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "none_", "=_", "self_", "._", "allow", "None_", ")_", "\\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 ", " _", "f_", "=_", "Fault_", "(_", "self_", "._", "FAILURE_", ",_", "\"", "Can", "'", "t", " ", "serialize", " ", "output", ":", " ", "%", "s", "\"_", "%_", "(_", "e_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "xmlrpclib_", "._", "dumps_", "(_", "f_", ",_", "method", "response_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "none_", "=_", "self_", "._", "allow", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "._", "set", "Header_", "(_", "\"", "content", "-", "length", "\"_", ",_", "str_", "(_", "len_", "(_", "content_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "write_", "(_", "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 ", " _", "log_", "._", "err_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Query", "Factory_", "(_", "protocol_", "._", "Client", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Response_", "(_", "self_", ",_", "contents_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "deferred_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "use", "Date", "Time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "xmlrpclib_", "._", "loads_", "(_", "contents_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "datetime_", "=_", "True_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Maint", "ain", " ", "back", "ward", "s", " ", "compatibility", " ", "with", " ", "Pyth", "on", " ", "<", " ", "2.5_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "xmlrpclib_", "._", "loads_", "(_", "contents_", ")_", "[_", "0_", "]_", "[_", "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 ", " _", "deferred_", ",_", "self_", "._", "deferred_", "=_", "self_", "._", "deferred_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deferred_", "._", "errback", "_", "(_", "failure_", "._", "Failure_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deferred_", ",_", "self_", "._", "deferred_", "=_", "self_", "._", "deferred_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deferred_", "._", "callback_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Proxy_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "url_", ",_", "user_", "=_", "None_", ",_", "password_", "=_", "None_", ",_", "allow", "None_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "Date", "Time_", "=_", "False_", ",_", "connect", "Timeout_", "=_", "30.0_", ",_", "reactor_", "=_", "reactor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "url", ":", " ", "The", " ", "URL", " ", "to", " ", "whi", "ch", " ", "to", " ", "post", " ", "method", " ", "calls", ".", " ", " ", "Calls", " ", "will", " ", "be", " ", "made", "\\", "10", ";", " ", " ", " ", " ", "over", " ", "SS", "L", " ", "if", " ", "the", " ", "sche", "me", " ", "is", " ", "HTTP", "S", ".", " ", " ", "If", " ", "net", "loc", " ", "contain", "s", " ", "user", "name", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "password", " ", "informati", "on", ",", " ", "these", " ", "will", " ", "be", " ", "used", " ", "to", " ", "authenticat", "e", ",", " ", "as", " ", "long", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "C", "{", "user", "}", " ", "and", " ", "C", "{", "password", "}", " ", "argu", "ment", "s", " ", "are", " ", "not", " ", "specified", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "url", ":", " ", "C", "{", "str", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheme_", ",_", "netloc_", ",_", "path_", ",_", "params_", ",_", "query_", ",_", "fragment_", "=_", "urlparse_", "._", "urlparse_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "net", "loc", "Parts_", "=_", "netloc_", "._", "split_", "(_", "'@'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "net", "loc", "Parts_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "userp", "ass_", "=_", "net", "loc", "Parts_", "._", "pop_", "(_", "0_", ")_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user_", "=_", "userp", "ass_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "password_", "=_", "userp", "ass_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "password_", "=_", "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_", "._", "user_", "=_", "self_", "._", "password_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hostp", "ort_", "=_", "net", "loc", "Parts_", "[_", "0_", "]_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "host_", "=_", "hostp", "ort_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "port_", "=_", "int_", "(_", "hostp", "ort_", "._", "pop_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "port_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "path_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "path_", "in_", "[_", "''_", ",_", "None_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "path_", "=_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "secure_", "=_", "(_", "scheme_", "==_", "'", "https", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "password_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "password_", "=_", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "allow", "None_", "=_", "allow", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "use", "Date", "Time_", "=_", "use", "Date", "Time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connect", "Timeout_", "=_", "connect", "Timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "reactor_", "=_", "reactor_", "\\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,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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 ]
Variable defined multiple times
panagiks/RSPET/Server/RSPET_server.py
[ { "content": "#!/usr/bin/python\n\nimport sys\nfrom socket import socket, AF_INET, SOCK_STREAM\nfrom thread import start_new_thread\nfrom threading import Thread\nfrom time import sleep\n \n\n\n\n \n\n\n\n \n \n\n\n\n\n\nroot_command_dict = {\n \"List_Commands\" : 0,\n \"List_Hosts\" : 1,\n \"Choose_Host\" : 2,\n \"Select\" : 3,\n \"ALL\" : 4,\n \"Exit\" : 5}\n\nconn_command_func_dict = {\n \"Make_File\" : Make_File,\n \"Make_Binary\" : Make_Binary,\n \"Pull_File\" : Pull_File,\n \"Pull_Binary\" : Pull_Binary,\n \"UDP_Flood\" : UDP_Flood}\n\nconn_mul_command_func_dict = {\n \"Make_File\" : Make_File,\n \"Make_Binary\" : Make_Binary,\n \"UDP_Flood\" : UDP_Flood}\n\nconn_command_dict = {\n \"List_Commands\" : 0,\n \"KILL\" : 1,\n \"Close_Connection\" : 2,\n \"Exit\" : 3}\n \nconn_mul_command_dict = {\n \"List_Commands\" : 0,\n \"List_Sel_Hosts\" : 1,\n \"KILL\" : 2,\n \"Close_Connection\" : 3,\n \"Exit\" : 4}\n\n#Start Here!\nmake_logo()\ntry:\n max_conns = int(sys.argv[1])\nexcept:\n max_conns = 5\n\ns = socket(AF_INET, SOCK_STREAM)\ns.bind((\"0.0.0.0\",9000))\ns.listen(max_conns)\n\nhandler = RSPET_client_handler()\nstart_new_thread(conn_accept,(s,handler))\n\nlist_root_commands()\nwhile True:\n handler.rebuild()\n comm_body = \"\"\n comm_args = []\n cur_host_ip = \"\"\n cur_host_id = 0\n command = raw_input(\"~$ \")\n command = command.split(\" \")\n comm_body = command[0]\n\n #Future Commands may require more than one args\n for i in range(1,len(command)):\n comm_args.append(command[i])\n try:\n translated = root_command_dict[comm_body]\n except:\n print (\"Command not recognised! Try List_Commands for help\")\n continue\n if translated == 0: #List_Commands\n list_root_commands()\n elif translated == 1: #List_Hosts\n active_hosts = handler.return_list_of_hosts()\n for i in range(len(active_hosts)):\n print (\"[\"+str(i)+\"] \"+active_hosts[i][1][0]+\":\"+str(active_hosts[i][1][1]))\n elif translated == 2: #Choose_Host\n try:\n cur_host_id = int(comm_args[0])\n except:\n print (\"Argument missing or not int\")\n continue\n active_hosts = handler.return_list_of_hosts()\n try:\n cur_host_ip = active_hosts[cur_host_id][1][0]\n cur_host_con = active_hosts[cur_host_id][0]\n except:\n print (\"Host ID out of bounds\")\n continue\n list_connected_commands()\n while True:\n command = raw_input(\"[\"+cur_host_ip+\"]~$ \")\n command = command.split(\" \")\n comm_body = command[0]\n try:\n comm_trans = conn_command_dict[comm_body]\n if comm_trans == 0: #List_Commands\n list_connected_commands()\n elif comm_trans == 1: #KILL\n res = send_comm('KILL',cur_host_con)\n if res == 1:\n print(\"Current host has closed its connection\")\n print(\"Exiting to main interface ...\")\n break\n elif comm_trans == 2: #Close_Connection\n cur_host_con.close()\n handler.remove_host(cur_host_id)\n break\n elif comm_trans == 3: #Exit\n break\n except KeyError:\n try:\n funcToCall = conn_command_func_dict[comm_body]\n argsToPass = command[1:]\n funcToCall(argsToPass,cur_host_con,cur_host_id,handler)\n except KeyError:\n com_reconst = command\n command = ''\n for part in com_reconst:\n command += part + \" \"\n command = command[:len(command)-1]\n res = send_comm(command,cur_host_con)\n if res == 1:\n print (\"Connection closed by client\")\n break\n decode = recv_comm(3072,cur_host_con)\n print (decode)\n elif translated == 3: #Select\n try:\n hosts_string = command[1]\n except:\n print (\"No host IDs provided\")\n list_of_selected_hosts = []\n try:\n hosts_string = hosts_string.split(\",\")\n for host_ID in hosts_string:\n list_of_selected_hosts.append(int(host_ID.replace(\" \",\"\")))\n except:\n print (\"Host IDs not integers\")\n continue\n list_connected_mult_commands()\n while True:\n command = raw_input(\"[MULTIPLE]~$ \")\n command = command.split(\" \")\n comm_body = command[0]\n try:\n comm_trans = conn_mul_command_dict[comm_body]\n if comm_trans == 0: #List_Commands\n list_connected_commands()\n elif comm_trans == 1: #List_Sel_Hosts\n active_hosts = handler.return_list_of_hosts()\n for host_ID in list_of_selected_hosts:\n if active_hosts[host_ID] == None:\n continue\n print (\"[\"+str(host_ID)+\"] \"+active_hosts[host_ID][1][0]+\":\"+str(active_hosts[host_ID][1][1]))\n elif comm_trans == 2: #KILL\n active_hosts = handler.return_list_of_hosts()\n for host_at_hand in list_of_selected_hosts:\n if active_hosts[host_at_hand] == None:\n continue\n send_comm('KILL',active_hosts[host_at_hand][0])\n elif comm_trans == 3: #Close_Connection\n jobs = []\n active_hosts = handler.return_list_of_hosts()\n for j in range(len(list_of_selected_hosts)-1,-1,-1):\n host_at_hand = list_of_selected_hosts[j]\n if active_hosts[host_at_hand] == None:\n continue\n active_hosts[host_at_hand][0].close()\n handler.remove_host(host_at_hand)\n break\n elif comm_trans == 4: #Exit\n break\n except KeyError:\n try:\n funcToCall = conn_mul_command_func_dict[comm_body]\n argsToPass = command[1:]\n active_hosts = handler.return_list_of_hosts()\n MultihostCalls(funcToCall, argsToPass, handler, list_of_selected_hosts)\n except KeyError:\n print (\"Command not recognised\")\n elif translated == 4: #ALL\n active_hosts = handler.return_list_of_hosts()\n list_of_selected_hosts = []\n for host_ID in range(len(active_hosts)):\n list_of_selected_hosts.append(host_ID)\n list_connected_mult_commands()\n while True:\n command = raw_input(\"[ALL]~$ \")\n command = command.split(\" \")\n comm_body = command[0]\n try:\n comm_trans = conn_mul_command_dict[comm_body]\n if comm_trans == 0: #List_Commands\n list_connected_commands()\n elif comm_trans == 1: #List_Sel_Hosts\n active_hosts = handler.return_list_of_hosts()\n for host_ID in list_of_selected_hosts:\n if active_hosts[host_ID] == None:\n continue\n print (\"[\"+str(host_ID)+\"] \"+active_hosts[host_ID][1][0]+\":\"+str(active_hosts[host_ID][1][1]))\n elif comm_trans == 2: #KILL\n active_hosts = handler.return_list_of_hosts()\n for host_at_hand in list_of_selected_hosts:\n if active_hosts[host_at_hand] == None:\n continue\n send_comm('KILL',active_hosts[host_at_hand][0])\n elif comm_trans == 3: #Close_Connection\n jobs = []\n active_hosts = handler.return_list_of_hosts()\n for j in range(len(list_of_selected_hosts)-1,-1,-1):\n host_at_hand = list_of_selected_hosts[j]\n if active_hosts[host_at_hand] == None:\n continue\n active_hosts[host_at_hand][0].close()\n handler.remove_host(host_at_hand)\n break\n elif comm_trans == 4: #Exit\n break\n except KeyError:\n try:\n funcToCall = conn_mul_command_func_dict[comm_body]\n argsToPass = command[1:]\n active_hosts = handler.return_list_of_hosts()\n MultihostCalls(funcToCall, argsToPass, handler, list_of_selected_hosts)\n except KeyError:\n print (\"Command not recognised\")\n elif translated == 5: #Exit\n sys.exit()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def Pull_File(nameSet, cur_host_con, cur_host_id, handler):\n remoteFileName = nameSet[0]\n try:\n localFileName = nameSet[1]\n except:\n localFileName = remoteFileName\n if localFileName == '':\n localFileName = remoteFileName\n res = send_comm('sendFile',cur_host_con)\n if res == 1:\n print (\"Connection closed by client\")\n handler.remove_host(cur_host_id)\n return 1\n res = send_comm(remoteFileName,cur_host_con)\n if res == 1:\n print (\"Connection closed by client\")\n handler.remove_host(cur_host_id)\n return 1\n decode = recv_comm(1024,cur_host_con)\n if decode == 'fna':\n print (\"File does not exist or Access Denied\")\n return 2\n else:\n try:\n localFileName = command[2]\n except:\n localFileName = command[1]\n try:\n localFile = open(localFileName,'w')\n except:\n print (\"Cannot create local file\")\n return 2\n decode = recv_comm(1024,cur_host_con)\n decode = recv_comm(int(decode),cur_host_con)\n localFile.write(decode)\n localFile.close()\n return 0", "metadata": "root.Pull_File", "header": "['module', '___EOS___']", "index": 134 }, { "content": "def Pull_Binary(nameSet, cur_host_con, cur_host_id, handler):\n remoteBinName = nameSet[0]\n try:\n localBinName = nameSet[1]\n except:\n localBinName = remoteBinName\n if localBinName == '':\n localBinName = remoteBinName\n try:\n remoteBinName = command[1]\n except:\n print (\"Remote binary name not provided\")\n return 2\n res = send_comm('sendBinary',cur_host_con)\n if res == 1:\n print (\"Connection closed by client\")\n handler.remove_host(cur_host_id)\n return 1\n res = send_comm(remoteBinName,cur_host_con)\n if res == 1:\n print (\"Connection closed by client\")\n handler.remove_host(cur_host_id)\n return 1\n decode = recv_comm(1024,cur_host_con)\n if decode == 'fna':\n print (\"File does not exist or Access Denied\")\n return 2\n else:\n try:\n localBinName = command[2]\n except:\n localBinName = command[1]\n try:\n localBin = open(localBinName,'wb')\n except:\n print (\"Cannot create local file\")\n return 2\n decode = recv_comm(1024,cur_host_con)\n decode = recv_comm(int(decode),cur_host_con)\n localBin.write(decode)\n localBin.close()\n return 0", "metadata": "root.Pull_Binary", "header": "['module', '___EOS___']", "index": 172 } ]
[ { "span": "active_hosts ", "start_line": 468, "start_column": 20, "end_line": 468, "end_column": 32 }, { "span": "active_hosts ", "start_line": 514, "start_column": 20, "end_line": 514, "end_column": 32 }, { "span": "localFileName ", "start_line": 141, "start_column": 8, "end_line": 141, "end_column": 21 }, { "span": "localBinName ", "start_line": 179, "start_column": 8, "end_line": 179, "end_column": 20 } ]
[ { "span": "active_hosts ", "start_line": 364, "start_column": 8, "end_line": 364, "end_column": 20 }, { "span": "active_hosts ", "start_line": 373, "start_column": 8, "end_line": 373, "end_column": 20 }, { "span": "active_hosts ", "start_line": 441, "start_column": 20, "end_line": 441, "end_column": 32 }, { "span": "active_hosts ", "start_line": 447, "start_column": 20, "end_line": 447, "end_column": 32 }, { "span": "active_hosts ", "start_line": 454, "start_column": 20, "end_line": 454, "end_column": 32 }, { "span": "active_hosts ", "start_line": 473, "start_column": 8, "end_line": 473, "end_column": 20 }, { "span": "active_hosts ", "start_line": 487, "start_column": 20, "end_line": 487, "end_column": 32 }, { "span": "active_hosts ", "start_line": 493, "start_column": 20, "end_line": 493, "end_column": 32 }, { "span": "active_hosts ", "start_line": 500, "start_column": 20, "end_line": 500, "end_column": 32 }, { "span": "localFileName ", "start_line": 158, "start_column": 12, "end_line": 158, "end_column": 25 }, { "span": "localFileName ", "start_line": 160, "start_column": 12, "end_line": 160, "end_column": 25 }, { "span": "localBinName ", "start_line": 201, "start_column": 12, "end_line": 201, "end_column": 24 }, { "span": "localBinName ", "start_line": 203, "start_column": 12, "end_line": 203, "end_column": 24 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "socket_", "import_", "socket_", ",_", "AF", "\\u", "INET_", ",_", "SOCK", "\\u", "STREAM_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thread_", "import_", "start", "\\u", "new", "\\u", "thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "threading_", "import_", "Thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "sleep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "root", "\\u", "command", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "List", "\\u", "Command", "s", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "List", "\\u", "Host", "s", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Choose", "\\u", "Host", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Select", "\"_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ALL", "\"_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Exi", "t", "\"_", ":_", "5_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conn", "\\u", "command", "\\u", "func", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Make", "\\u", "File", "\"_", ":_", "Make", "\\u", "File_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Make", "\\u", "Bin", "ary", "\"_", ":_", "Make", "\\u", "Binary_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Pul", "l\\u", "File", "\"_", ":_", "Pul", "l\\u", "File_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Pul", "l\\u", "Bin", "ary", "\"_", ":_", "Pul", "l\\u", "Binary_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "UD", "P", "\\u", "Flood", "\"_", ":_", "UD", "P", "\\u", "Flood", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conn", "\\u", "mul", "\\u", "command", "\\u", "func", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Make", "\\u", "File", "\"_", ":_", "Make", "\\u", "File_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Make", "\\u", "Bin", "ary", "\"_", ":_", "Make", "\\u", "Binary_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "UD", "P", "\\u", "Flood", "\"_", ":_", "UD", "P", "\\u", "Flood", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conn", "\\u", "command", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "List", "\\u", "Command", "s", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "KILL", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Clos", "e\\u", "Connect", "ion", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Exi", "t", "\"_", ":_", "3_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conn", "\\u", "mul", "\\u", "command", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "List", "\\u", "Command", "s", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "List", "\\u", "Sel", "\\u", "Host", "s", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "KILL", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Clos", "e\\u", "Connect", "ion", "\"_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Exi", "t", "\"_", ":_", "4_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Start", " ", "Her", "e", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "make", "\\u", "logo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "\\u", "conns_", "=_", "int_", "(_", "sys_", "._", "argv_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "\\u", "conns_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "socket_", "(_", "AF", "\\u", "INET_", ",_", "SOCK", "\\u", "STREAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "bind_", "(_", "(_", "\"", "0.", "0.", "0.", "0", "\"_", ",_", "9000", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "listen_", "(_", "max", "\\u", "conns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "RS", "PE", "T", "\\u", "client", "\\u", "handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "new", "\\u", "thread_", "(_", "conn", "\\u", "accept_", ",_", "(_", "s_", ",_", "handler_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list", "\\u", "root", "\\u", "commands_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "._", "rebuild_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comm", "\\u", "body_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comm", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "host", "\\u", "ip_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "host", "\\u", "id_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "=_", "raw", "\\u", "input_", "(_", "\"", "~", "$", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "=_", "command_", "._", "split_", "(_", "\"", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comm", "\\u", "body_", "=_", "command_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Fu", "ture", " ", "Command", "s", " ", "may", " ", "require", " ", "more", " ", "than", " ", "one", " ", "args_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "len_", "(_", "command_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comm", "\\u", "args_", "._", "append_", "(_", "command_", "[_", "i_", "]_", ")_", "\\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 ", " _", "translated_", "=_", "root", "\\u", "command", "\\u", "dict_", "[_", "comm", "\\u", "body_", "]_", "\\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_", "(_", "\"", "Command", " ", "not", " ", "recog", "nis", "ed", "!", " ", "Tr", "y", " ", "List", "\\u", "Command", "s", " ", "for", " ", "help", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "translated_", "==_", "0_", ":_", "#", "List", "\\u", "Commands_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "root", "\\u", "commands_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "translated_", "==_", "1_", ":_", "#", "List", "\\u", "Host", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "active", "\\u", "hosts_", "=_", "handler_", "._", "return", "\\u", "list", "\\u", "of", "\\u", "hosts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "active", "\\u", "hosts_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"[\"_", "+_", "str_", "(_", "i_", ")_", "+_", "\"]", " ", "\"_", "+_", "active", "\\u", "hosts_", "[_", "i_", "]_", "[_", "1_", "]_", "[_", "0_", "]_", "+_", "\":\"_", "+_", "str_", "(_", "active", "\\u", "hosts_", "[_", "i_", "]_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "translated_", "==_", "2_", ":_", "#", "Choose", "\\u", "Host_", "\\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 ", " _", "cur", "\\u", "host", "\\u", "id_", "=_", "int_", "(_", "comm", "\\u", "args_", "[_", "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 ", " _", "print_", "(_", "\"", "Arg", "ument", " ", "missi", "ng", " ", "or", " ", "not", " ", "int", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "active", "\\u", "hosts_", "=_", "handler_", "._", "return", "\\u", "list", "\\u", "of", "\\u", "hosts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur", "\\u", "host", "\\u", "ip_", "=_", "active", "\\u", "hosts_", "[_", "cur", "\\u", "host", "\\u", "id_", "]_", "[_", "1_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "host", "\\u", "con_", "=_", "active", "\\u", "hosts_", "[_", "cur", "\\u", "host", "\\u", "id_", "]_", "[_", "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 ", " _", "print_", "(_", "\"", "Host", " ", "ID", " ", "out", " ", "of", " ", "bound", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "list", "\\u", "connect", "ed", "\\u", "commands_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "raw", "\\u", "input_", "(_", "\"[\"_", "+_", "cur", "\\u", "host", "\\u", "ip_", "+_", "\"]", "~", "$", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "=_", "command_", "._", "split_", "(_", "\"", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comm", "\\u", "body_", "=_", "command_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comm", "\\u", "trans_", "=_", "conn", "\\u", "command", "\\u", "dict_", "[_", "comm", "\\u", "body_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "comm", "\\u", "trans_", "==_", "0_", ":_", "#", "List", "\\u", "Commands_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "list", "\\u", "connect", "ed", "\\u", "commands_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "comm", "\\u", "trans_", "==_", "1_", ":_", "#", "KILL", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "res_", "=_", "send", "\\u", "comm_", "(_", "'", "KILL", "'_", ",_", "cur", "\\u", "host", "\\u", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "res_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "(_", "\"", "Curr", "ent", " ", "host", " ", "has", " ", "close", "d", " ", "its", " ", "connecti", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Exi", "ting", " ", "to", " ", "main", " ", "interface", " ", "...\"_", ")_", "\\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_", "elif_", "comm", "\\u", "trans_", "==_", "2_", ":_", "#", "Clos", "e\\u", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cur", "\\u", "host", "\\u", "con_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "remove", "\\u", "host_", "(_", "cur", "\\u", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "comm", "\\u", "trans_", "==_", "3_", ":_", "#", "Exit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "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 ", " ", "_", "func", "To", "Call_", "=_", "conn", "\\u", "command", "\\u", "func", "\\u", "dict_", "[_", "comm", "\\u", "body_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "To", "Pass_", "=_", "command_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "func", "To", "Call_", "(_", "args", "To", "Pass_", ",_", "cur", "\\u", "host", "\\u", "con_", ",_", "cur", "\\u", "host", "\\u", "id_", ",_", "handler_", ")_", "\\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 ", " ", "_", "com", "\\u", "recon", "st_", "=_", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "part_", "in_", "com", "\\u", "recon", "st_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "command_", "+=_", "part_", "+_", "\"", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "=_", "command_", "[_", ":_", "len_", "(_", "command_", ")_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "send", "\\u", "comm_", "(_", "command_", ",_", "cur", "\\u", "host", "\\u", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "res_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "(_", "\"", "Connect", "ion", " ", "close", "d", " ", "by", " ", "client", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "decode_", "=_", "recv", "\\u", "comm_", "(_", "307", "2_", ",_", "cur", "\\u", "host", "\\u", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "decode_", ")_", "\\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_", "elif_", "translated_", "==_", "3_", ":_", "#", "Select_", "\\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 ", " _", "host", "s", "\\u", "string_", "=_", "command_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "No", " ", "host", " ", "ID", "s", " ", "provided", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "list", "\\u", "of", "\\u", "selecte", "d\\u", "hosts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "s", "\\u", "string_", "=_", "host", "s", "\\u", "string_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "host", "\\u", "ID_", "in_", "host", "s", "\\u", "string_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "of", "\\u", "selecte", "d\\u", "hosts_", "._", "append_", "(_", "int_", "(_", "host", "\\u", "ID_", "._", "replace_", "(_", "\"", " ", "\"_", ",_", "\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Host", " ", "ID", "s", " ", "not", " ", "integ", "ers", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "list", "\\u", "connect", "ed", "\\u", "mult", "\\u", "commands_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "raw", "\\u", "input_", "(_", "\"[", "MULTIPLE", "]", "~", "$", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "=_", "command_", "._", "split_", "(_", "\"", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comm", "\\u", "body_", "=_", "command_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comm", "\\u", "trans_", "=_", "conn", "\\u", "mul", "\\u", "command", "\\u", "dict_", "[_", "comm", "\\u", "body_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "comm", "\\u", "trans_", "==_", "0_", ":_", "#", "List", "\\u", "Commands_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "list", "\\u", "connect", "ed", "\\u", "commands_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "comm", "\\u", "trans_", "==_", "1_", ":_", "#", "List", "\\u", "Sel", "\\u", "Host", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "active", "\\u", "hosts_", "=_", "handler_", "._", "return", "\\u", "list", "\\u", "of", "\\u", "hosts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "host", "\\u", "ID_", "in_", "list", "\\u", "of", "\\u", "selecte", "d\\u", "hosts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "active", "\\u", "hosts_", "[_", "host", "\\u", "ID_", "]_", "==_", "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_", "print_", "(_", "\"[\"_", "+_", "str_", "(_", "host", "\\u", "ID_", ")_", "+_", "\"]", " ", "\"_", "+_", "active", "\\u", "hosts_", "[_", "host", "\\u", "ID_", "]_", "[_", "1_", "]_", "[_", "0_", "]_", "+_", "\":\"_", "+_", "str_", "(_", "active", "\\u", "hosts_", "[_", "host", "\\u", "ID_", "]_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "comm", "\\u", "trans_", "==_", "2_", ":_", "#", "KILL", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "active", "\\u", "hosts_", "=_", "handler_", "._", "return", "\\u", "list", "\\u", "of", "\\u", "hosts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "host", "\\u", "at", "\\u", "hand_", "in_", "list", "\\u", "of", "\\u", "selecte", "d\\u", "hosts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "active", "\\u", "hosts_", "[_", "host", "\\u", "at", "\\u", "hand_", "]_", "==_", "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_", "send", "\\u", "comm_", "(_", "'", "KILL", "'_", ",_", "active", "\\u", "hosts_", "[_", "host", "\\u", "at", "\\u", "hand_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "comm", "\\u", "trans_", "==_", "3_", ":_", "#", "Clos", "e\\u", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "jobs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "active", "\\u", "hosts_", "=_", "handler_", "._", "return", "\\u", "list", "\\u", "of", "\\u", "hosts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "len_", "(_", "list", "\\u", "of", "\\u", "selecte", "d\\u", "hosts_", ")_", "-_", "1_", ",_", "-_", "1_", ",_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "host", "\\u", "at", "\\u", "hand_", "=_", "list", "\\u", "of", "\\u", "selecte", "d\\u", "hosts_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "active", "\\u", "hosts_", "[_", "host", "\\u", "at", "\\u", "hand_", "]_", "==_", "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_", "active", "\\u", "hosts_", "[_", "host", "\\u", "at", "\\u", "hand_", "]_", "[_", "0_", "]_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "remove", "\\u", "host_", "(_", "host", "\\u", "at", "\\u", "hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "comm", "\\u", "trans_", "==_", "4_", ":_", "#", "Exit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "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 ", " ", "_", "func", "To", "Call_", "=_", "conn", "\\u", "mul", "\\u", "command", "\\u", "func", "\\u", "dict_", "[_", "comm", "\\u", "body_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "To", "Pass_", "=_", "command_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "active", "\\u", "hosts_", "=_", "handler_", "._", "return", "\\u", "list", "\\u", "of", "\\u", "hosts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Multi", "host", "Calls", "_", "(_", "func", "To", "Call_", ",_", "args", "To", "Pass_", ",_", "handler_", ",_", "list", "\\u", "of", "\\u", "selecte", "d\\u", "hosts_", ")_", "\\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 ", " ", "_", "print_", "(_", "\"", "Command", " ", "not", " ", "recog", "nis", "ed", "\"_", ")_", "\\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_", "elif_", "translated_", "==_", "4_", ":_", "#", "ALL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "active", "\\u", "hosts_", "=_", "handler_", "._", "return", "\\u", "list", "\\u", "of", "\\u", "hosts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "of", "\\u", "selecte", "d\\u", "hosts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "host", "\\u", "ID_", "in_", "range_", "(_", "len_", "(_", "active", "\\u", "hosts_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "of", "\\u", "selecte", "d\\u", "hosts_", "._", "append_", "(_", "host", "\\u", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "list", "\\u", "connect", "ed", "\\u", "mult", "\\u", "commands_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "raw", "\\u", "input_", "(_", "\"[", "ALL", "]", "~", "$", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "=_", "command_", "._", "split_", "(_", "\"", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comm", "\\u", "body_", "=_", "command_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comm", "\\u", "trans_", "=_", "conn", "\\u", "mul", "\\u", "command", "\\u", "dict_", "[_", "comm", "\\u", "body_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "comm", "\\u", "trans_", "==_", "0_", ":_", "#", "List", "\\u", "Commands_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "list", "\\u", "connect", "ed", "\\u", "commands_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "comm", "\\u", "trans_", "==_", "1_", ":_", "#", "List", "\\u", "Sel", "\\u", "Host", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "active", "\\u", "hosts_", "=_", "handler_", "._", "return", "\\u", "list", "\\u", "of", "\\u", "hosts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "host", "\\u", "ID_", "in_", "list", "\\u", "of", "\\u", "selecte", "d\\u", "hosts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "active", "\\u", "hosts_", "[_", "host", "\\u", "ID_", "]_", "==_", "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_", "print_", "(_", "\"[\"_", "+_", "str_", "(_", "host", "\\u", "ID_", ")_", "+_", "\"]", " ", "\"_", "+_", "active", "\\u", "hosts_", "[_", "host", "\\u", "ID_", "]_", "[_", "1_", "]_", "[_", "0_", "]_", "+_", "\":\"_", "+_", "str_", "(_", "active", "\\u", "hosts_", "[_", "host", "\\u", "ID_", "]_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "comm", "\\u", "trans_", "==_", "2_", ":_", "#", "KILL", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "active", "\\u", "hosts_", "=_", "handler_", "._", "return", "\\u", "list", "\\u", "of", "\\u", "hosts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "host", "\\u", "at", "\\u", "hand_", "in_", "list", "\\u", "of", "\\u", "selecte", "d\\u", "hosts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "active", "\\u", "hosts_", "[_", "host", "\\u", "at", "\\u", "hand_", "]_", "==_", "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_", "send", "\\u", "comm_", "(_", "'", "KILL", "'_", ",_", "active", "\\u", "hosts_", "[_", "host", "\\u", "at", "\\u", "hand_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "comm", "\\u", "trans_", "==_", "3_", ":_", "#", "Clos", "e\\u", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "jobs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "active", "\\u", "hosts_", "=_", "handler_", "._", "return", "\\u", "list", "\\u", "of", "\\u", "hosts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "len_", "(_", "list", "\\u", "of", "\\u", "selecte", "d\\u", "hosts_", ")_", "-_", "1_", ",_", "-_", "1_", ",_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "host", "\\u", "at", "\\u", "hand_", "=_", "list", "\\u", "of", "\\u", "selecte", "d\\u", "hosts_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "active", "\\u", "hosts_", "[_", "host", "\\u", "at", "\\u", "hand_", "]_", "==_", "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_", "active", "\\u", "hosts_", "[_", "host", "\\u", "at", "\\u", "hand_", "]_", "[_", "0_", "]_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "remove", "\\u", "host_", "(_", "host", "\\u", "at", "\\u", "hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "comm", "\\u", "trans_", "==_", "4_", ":_", "#", "Exit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "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 ", " ", "_", "func", "To", "Call_", "=_", "conn", "\\u", "mul", "\\u", "command", "\\u", "func", "\\u", "dict_", "[_", "comm", "\\u", "body_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "To", "Pass_", "=_", "command_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "active", "\\u", "hosts_", "=_", "handler_", "._", "return", "\\u", "list", "\\u", "of", "\\u", "hosts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Multi", "host", "Calls", "_", "(_", "func", "To", "Call_", ",_", "args", "To", "Pass_", ",_", "handler_", ",_", "list", "\\u", "of", "\\u", "selecte", "d\\u", "hosts_", ")_", "\\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 ", " ", "_", "print_", "(_", "\"", "Command", " ", "not", " ", "recog", "nis", "ed", "\"_", ")_", "\\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_", "elif_", "translated_", "==_", "5_", ":_", "#", "Exit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Pul", "l\\u", "File_", "(_", "name", "Set_", ",_", "cur", "\\u", "host", "\\u", "con_", ",_", "cur", "\\u", "host", "\\u", "id_", ",_", "handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "File", "Name_", "=_", "name", "Set_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "File", "Name_", "=_", "name", "Set_", "[_", "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 ", " _", "local", "File", "Name_", "=_", "remote", "File", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "local", "File", "Name_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "File", "Name_", "=_", "remote", "File", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "send", "\\u", "comm_", "(_", "'", "send", "File", "'_", ",_", "cur", "\\u", "host", "\\u", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "res_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Connect", "ion", " ", "close", "d", " ", "by", " ", "client", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "remove", "\\u", "host_", "(_", "cur", "\\u", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "send", "\\u", "comm_", "(_", "remote", "File", "Name_", ",_", "cur", "\\u", "host", "\\u", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "res_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Connect", "ion", " ", "close", "d", " ", "by", " ", "client", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "remove", "\\u", "host_", "(_", "cur", "\\u", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "decode_", "=_", "recv", "\\u", "comm_", "(_", "1024_", ",_", "cur", "\\u", "host", "\\u", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "decode_", "==_", "'", "fna", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "File", " ", "doe", "s", " ", "not", " ", "exist", " ", "or", " ", "Access", " ", "Den", "ied", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "File", "Name_", "=_", "command_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "File", "Name_", "=_", "command_", "[_", "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 ", " _", "local", "File_", "=_", "open_", "(_", "local", "File", "Name_", ",_", "'", "w", "'_", ")_", "\\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_", "(_", "\"", "Cann", "ot", " ", "create", " ", "local", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "decode_", "=_", "recv", "\\u", "comm_", "(_", "1024_", ",_", "cur", "\\u", "host", "\\u", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decode_", "=_", "recv", "\\u", "comm_", "(_", "int_", "(_", "decode_", ")_", ",_", "cur", "\\u", "host", "\\u", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "File_", "._", "write_", "(_", "decode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "File_", "._", "close_", "(_", ")_", "\\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_", "def_", "Pul", "l\\u", "Binary_", "(_", "name", "Set_", ",_", "cur", "\\u", "host", "\\u", "con_", ",_", "cur", "\\u", "host", "\\u", "id_", ",_", "handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "Bin", "Name_", "=_", "name", "Set_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "Bin", "Name_", "=_", "name", "Set_", "[_", "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 ", " _", "local", "Bin", "Name_", "=_", "remote", "Bin", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "local", "Bin", "Name_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "Bin", "Name_", "=_", "remote", "Bin", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "Bin", "Name_", "=_", "command_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Remo", "te", " ", "binar", "y", " ", "name", " ", "not", " ", "provided", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "send", "\\u", "comm_", "(_", "'", "send", "Bin", "ary", "'_", ",_", "cur", "\\u", "host", "\\u", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "res_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Connect", "ion", " ", "close", "d", " ", "by", " ", "client", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "remove", "\\u", "host_", "(_", "cur", "\\u", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "send", "\\u", "comm_", "(_", "remote", "Bin", "Name_", ",_", "cur", "\\u", "host", "\\u", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "res_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Connect", "ion", " ", "close", "d", " ", "by", " ", "client", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "remove", "\\u", "host_", "(_", "cur", "\\u", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "decode_", "=_", "recv", "\\u", "comm_", "(_", "1024_", ",_", "cur", "\\u", "host", "\\u", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "decode_", "==_", "'", "fna", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "File", " ", "doe", "s", " ", "not", " ", "exist", " ", "or", " ", "Access", " ", "Den", "ied", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "Bin", "Name_", "=_", "command_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "Bin", "Name_", "=_", "command_", "[_", "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 ", " _", "local", "Bin_", "=_", "open_", "(_", "local", "Bin", "Name_", ",_", "'", "wb", "'_", ")_", "\\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_", "(_", "\"", "Cann", "ot", " ", "create", " ", "local", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "decode_", "=_", "recv", "\\u", "comm_", "(_", "1024_", ",_", "cur", "\\u", "host", "\\u", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decode_", "=_", "recv", "\\u", "comm_", "(_", "int_", "(_", "decode_", ")_", ",_", "cur", "\\u", "host", "\\u", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "Bin_", "._", "write_", "(_", "decode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "Bin_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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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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 ]
Unused import
karesansui/karesansui/bin/delete_disk.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# This file is part of Karesansui.\n#\n# Copyright (C) 2012 HDE, Inc.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\nimport os\nimport sys\nimport logging\nfrom optparse import OptionParser\n\nfrom ksscommand import KssCommand, KssCommandOptException\n\nimport __cmd__\n\ntry:\n import karesansui\n from karesansui import __version__\n from karesansui.lib.virt.virt import KaresansuiVirtConnection\n from karesansui.lib.utils import load_locale\nexcept ImportError:\n print >>sys.stderr, \"[Error] karesansui package was not found.\"\n sys.exit(1)\n\n_ = load_locale()\n\nusage = '%prog [options]'\n\n\n\n\nif __name__ == \"__main__\":\n target = DeleteDisk()\n sys.exit(target.run())\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def getopts():\n optp = OptionParser(usage=usage, version=__version__)\n optp.add_option('-n', '--name', dest='name', help=_('Domain Name'))\n optp.add_option('-t', '--target', dest='target', help=_('Device target'))\n return optp.parse_args()", "metadata": "root.getopts", "header": "['module', '___EOS___']", "index": 48 }, { "content": "def chkopts(opts):\n if not opts.name:\n raise KssCommandOptException('ERROR: %s option is required.' % '-n or --name')\n if not opts.target:\n raise KssCommandOptException('ERROR: %s option is required.' % '-t or --target')", "metadata": "root.chkopts", "header": "['module', '___EOS___']", "index": 54 }, { "content": "class DeleteDisk(KssCommand):\n", "metadata": "root.DeleteDisk", "header": "['module', '___EOS___']", "index": 60 }, { "content": " def process(self):\n (opts, args) = getopts()\n chkopts(opts)\n self.up_progress(10)\n\n conn = KaresansuiVirtConnection(readonly=False)\n try:\n conn.set_domain_name(opts.name)\n\n self.up_progress(10)\n conn.guest.delete_disk(opts.target)\n self.up_progress(40)\n self.logger.info('Deleted disk device. - dom=%s target=%s' % (opts.name,opts.target))\n print >>sys.stdout, _('Deleted disk device. - dom=%s target=%s') % (opts.name, opts.target)\n\n return True\n finally:\n conn.close()", "metadata": "root.DeleteDisk.process", "header": "['class', 'DeleteDisk', '(', 'KssCommand', ')', ':', '___EOS___']", "index": 62 } ]
[ { "span": "import os", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 9 }, { "span": "import logging", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 14 }, { "span": "import karesansui", "start_line": 36, "start_column": 4, "end_line": 36, "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_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Kar", "esa", "nsu", "i", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2012", " ", "HD", "E", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "Optio", "n", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ks", "sco", "mmand", "_", "import_", "Ks", "s", "Command_", ",_", "Ks", "s", "Command", "Opt", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "\\u\\u", "cmd", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "kar", "esa", "nsu", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "import_", "\\u\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "virt_", "._", "virt_", "import_", "Kar", "esa", "nsu", "i", "Virt", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "load", "\\u", "locale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"[", "Error", "]", " ", "kar", "esa", "nsu", "i", " ", "package", " ", "was", " ", "not", " ", "found", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u_", "=_", "load", "\\u", "locale_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "usage_", "=_", "'%", "prog", " ", "[", "options", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "target_", "=_", "Delete", "Disk_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "target_", "._", "run_", "(_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "getop", "ts_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opt", "p_", "=_", "Optio", "n", "Parser_", "(_", "usage_", "=_", "usage_", ",_", "version_", "=_", "\\u\\u", "version\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "n", "'_", ",_", "'--", "name", "'_", ",_", "dest_", "=_", "'", "name", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Doma", "in", " ", "Name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "t", "'_", ",_", "'--", "target", "'_", ",_", "dest_", "=_", "'", "target", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Dev", "ice", " ", "target", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "opt", "p_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "chk", "opts_", "(_", "opts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "opts_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "%", "s", " ", "option", " ", "is", " ", "require", "d", ".'_", "%_", "'-", "n", " ", "or", " ", "--", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "opts_", "._", "target_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "%", "s", " ", "option", " ", "is", " ", "require", "d", ".'_", "%_", "'-", "t", " ", "or", " ", "--", "target", "'_", ")_", "\\u\\u\\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_", "Delete", "Disk_", "(_", "Ks", "s", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Delete", "Disk_", "(_", "Ks", "s", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "process_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "opts_", ",_", "args_", ")_", "=_", "getop", "ts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chk", "opts_", "(_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "up", "\\u", "progress_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conn_", "=_", "Kar", "esa", "nsu", "i", "Virt", "Connection_", "(_", "readonly_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "set\\u", "domain", "\\u", "name_", "(_", "opts_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "up", "\\u", "progress_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "guest_", "._", "delete", "\\u", "disk_", "(_", "opts_", "._", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "up", "\\u", "progress_", "(_", "40_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "info_", "(_", "'", "Delete", "d", " ", "disk", " ", "device", ".", " ", "-", " ", "dom", "=", "%", "s", " ", "target", "=", "%", "s", "'_", "%_", "(_", "opts_", "._", "name_", ",_", "opts_", "._", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "sys_", "._", "stdout_", ",_", "\\u_", "(_", "'", "Delete", "d", " ", "disk", " ", "device", ".", " ", "-", " ", "dom", "=", "%", "s", " ", "target", "=", "%", "s", "'_", ")_", "%_", "(_", "opts_", "._", "name_", ",_", "opts_", "._", "target_", ")_", "\\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_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "close_", "(_", ")_", "\\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,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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
AppScale/appscale/AppServer/google/appengine/tools/devappserver2/channel.py
[ { "content": "#!/usr/bin/env python\n#\n# Copyright 2007 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\"\"\"Handles Channel API requests.\n\nIncludes a WSGI application that serves the 'jsapi' JavaScript code and handles\nchannel polling HTTP requests, to connect and retrieve messages.\n\"\"\"\n\n\nimport os\n\nimport google\nimport webapp2\n\nfrom google.appengine.api import apiproxy_stub_map\nfrom google.appengine.api.channel import channel_service_stub\n\n# Regex for all requests routed through this module.\n# Note: Other URLs in the _ah/channel namespace may be handled by the user.\nCHANNEL_URL_PATTERN = '_ah/channel/(?:jsapi|dev)'\n\n_JSAPI_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)),\n 'appscale-channel-js-min.js')\n\n# These error statuses (including the message) are explicitly mandated in the\n# Channel JavaScript documentation.\nINVALID_TOKEN_STATUS = '401 Invalid+token.'\nTOKEN_TIMED_OUT_STATUS = '401 Token+timed+out.'\n\n\n\n\n\n\n\n\napplication = webapp2.WSGIApplication([\n ('/_ah/channel/dev', DevHandler),\n ('/_ah/channel/jsapi', JSAPIHandler),\n], debug=True)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _get_channel_stub():\n \"\"\"Gets the ChannelServiceStub instance from the API proxy stub map.\n\n Returns:\n The ChannelServiceStub instance as registered in the API stub map.\n \"\"\"\n return apiproxy_stub_map.apiproxy.GetStub('channel')", "metadata": "root._get_channel_stub", "header": "['module', '___EOS___']", "index": 44 }, { "content": "class DevHandler(webapp2.RequestHandler):\n \"\"\"The request handler for the 'connect' and 'poll' requests.\"\"\"\n", "metadata": "root.DevHandler", "header": "['module', '___EOS___']", "index": 53 }, { "content": " def get(self):\n # Remove the default Content-Type. If there is any content, the correct\n # Content-Type will be set later.\n del self.response.headers['Content-Type']\n stub = _get_channel_stub()\n\n command = self.request.get('command', None)\n token = self.request.get('channel', None)\n if command is None or token is None:\n self.response.status = 400\n return\n\n if command == 'connect':\n try:\n stub.connect_channel(token)\n except channel_service_stub.InvalidTokenError:\n self.response.status = INVALID_TOKEN_STATUS\n return\n except channel_service_stub.TokenTimedOutError:\n self.response.status = TOKEN_TIMED_OUT_STATUS\n return\n self.response.headers['Content-Type'] = 'text/plain'\n self.response.out.write('1')\n elif command == 'poll':\n try:\n # TODO: Wait up to N seconds for a message to arrive before\n # returning empty (long poll).\n message = stub.connect_and_pop_first_message(token)\n except channel_service_stub.InvalidTokenError:\n self.response.status = INVALID_TOKEN_STATUS\n return\n except channel_service_stub.TokenTimedOutError:\n self.response.status = TOKEN_TIMED_OUT_STATUS\n return\n if message is not None:\n self.response.headers['Content-Type'] = 'application/json'\n self.response.out.write(message)\n else:\n self.response.status = 400", "metadata": "root.DevHandler.get", "header": "['class', 'DevHandler', '(', 'webapp2', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 56 }, { "content": "class JSAPIHandler(webapp2.RequestHandler):\n \"\"\"The request handler for the jsapi static JavaScript code.\"\"\"\n", "metadata": "root.JSAPIHandler", "header": "['module', '___EOS___']", "index": 97 }, { "content": " def get(self):\n # TODO: Reuse code in static_files_handler to do cache control.\n self.response.headers['Content-Type'] = 'text/javascript'\n self.response.out.write(open(_JSAPI_PATH).read())", "metadata": "root.JSAPIHandler.get", "header": "['class', 'JSAPIHandler', '(', 'webapp2', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 100 } ]
[ { "span": "import google", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2007", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Handle", "s", " ", "Chan", "nel", " ", "API", " ", "request", "s", ".", "\\", "10", ";", "\\", "10", ";", "Includes", " ", "a", " ", "WS", "GI", " ", "applica", "tion", " ", "tha", "t", " ", "serve", "s", " ", "the", " ", "'", "js", "api", "'", " ", "Ja", "va", "Script", " ", "code", " ", "and", " ", "handle", "s", "\\", "10", ";", "channel", " ", "polling", " ", "HTTP", " ", "request", "s", ",", " ", "to", " ", "connect", " ", "and", " ", "retrieve", " ", "message", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "google_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "webapp2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "api", "proxy", "\\u", "stub", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "._", "channel_", "import_", "channel", "\\u", "service", "\\u", "stub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rege", "x", " ", "for", " ", "all", " ", "request", "s", " ", "route", "d", " ", "through", " ", "this", " ", "module", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "Ot", "her", " ", "URL", "s", " ", "in", " ", "the", " ", "\\u", "ah", "/", "channel", " ", "namespace", " ", "may", " ", "be", " ", "handle", "d", " ", "by", " ", "the", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "CHAN", "NEL", "\\u", "URL", "\\u", "PATTERN_", "=_", "'\\u", "ah", "/", "channel", "/(", "?:", "js", "api", "|", "dev", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "JS", "API", "\\u", "PATH_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "apps", "cale", "-", "channel", "-", "js", "-", "min", ".", "js", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "error", " ", "status", "es", " ", "(", "inclu", "ding", " ", "the", " ", "message", ")", " ", "are", " ", "explicit", "ly", " ", "mandat", "ed", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Chan", "nel", " ", "Ja", "va", "Script", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "INVALID", "\\u", "TOKEN", "\\u", "STATUS_", "=_", "'", "401", " ", "Inva", "lid", "+", "token", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TOKEN", "\\u", "TIME", "D", "\\u", "OUT", "\\u", "STATUS_", "=_", "'", "401", " ", "Token", "+", "timed", "+", "out", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "application_", "=_", "webapp2_", "._", "WS", "GI", "Application_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/\\", "ua", "h", "/", "channel", "/", "dev", "'_", ",_", "Dev", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/\\", "ua", "h", "/", "channel", "/", "js", "api", "'_", ",_", "JS", "API", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "debug_", "=_", "True_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "channel", "\\u", "stub_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", "s", " ", "the", " ", "Chan", "nel", "Service", "Stu", "b", " ", "instance", " ", "from", " ", "the", " ", "API", " ", "proxy", " ", "stub", " ", "map", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Chan", "nel", "Service", "Stu", "b", " ", "instance", " ", "as", " ", "register", "ed", " ", "in", " ", "the", " ", "API", " ", "stub", " ", "map", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "api", "proxy", "\\u", "stub", "\\u", "map_", "._", "api", "proxy_", "._", "Get", "Stub_", "(_", "'", "channel", "'_", ")_", "\\u\\u\\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_", "Dev", "Handler_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "request", " ", "handler", " ", "for", " ", "the", " ", "'", "connect", "'", " ", "and", " ", "'", "poll", "'", " ", "request", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Dev", "Handler_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Remove", " ", "the", " ", "default", " ", "Conten", "t", "-", "Type", ".", " ", "If", " ", "there", " ", "is", " ", "any", " ", "content", ",", " ", "the", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Conten", "t", "-", "Type", " ", "will", " ", "be", " ", "set", " ", "late", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "response_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stub_", "=_", "\\u", "get", "\\u", "channel", "\\u", "stub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "command", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "channel", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "command_", "is_", "None_", "or_", "token_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "response_", "._", "status_", "=_", "400_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "command_", "==_", "'", "connect", "'_", ":_", "\\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 ", " _", "stub_", "._", "connect", "\\u", "channel_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "channel", "\\u", "service", "\\u", "stub_", "._", "Inva", "lid", "Token", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "response_", "._", "status_", "=_", "INVALID", "\\u", "TOKEN", "\\u", "STATUS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "channel", "\\u", "service", "\\u", "stub_", "._", "Token", "Time", "d", "Out", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "response_", "._", "status_", "=_", "TOKEN", "\\u", "TIME", "D", "\\u", "OUT", "\\u", "STATUS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "response_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "=_", "'", "text", "/", "plain", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "out_", "._", "write_", "(_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "command_", "==_", "'", "poll", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Wait", " ", "up", " ", "to", " ", "N", " ", "second", "s", " ", "for", " ", "a", " ", "message", " ", "to", " ", "arrive", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", "ing", " ", "empty", " ", "(", "long", " ", "poll", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "stub_", "._", "connect", "\\u", "and", "\\u", "pop", "\\u", "first", "\\u", "message_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "channel", "\\u", "service", "\\u", "stub_", "._", "Inva", "lid", "Token", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "response_", "._", "status_", "=_", "INVALID", "\\u", "TOKEN", "\\u", "STATUS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "channel", "\\u", "service", "\\u", "stub_", "._", "Token", "Time", "d", "Out", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "response_", "._", "status_", "=_", "TOKEN", "\\u", "TIME", "D", "\\u", "OUT", "\\u", "STATUS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "message_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "response_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "out_", "._", "write_", "(_", "message_", ")_", "\\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_", "._", "response_", "._", "status_", "=_", "400_", "\\u\\u\\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_", "JS", "API", "Handler_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "request", " ", "handler", " ", "for", " ", "the", " ", "js", "api", " ", "static", " ", "Ja", "va", "Script", " ", "code", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "JS", "API", "Handler_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Reu", "se", " ", "code", " ", "in", " ", "static", "\\u", "files", "\\u", "handler", " ", "to", " ", "do", " ", "cache", " ", "control", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "response_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "=_", "'", "text", "/", "javascript", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "out_", "._", "write_", "(_", "open_", "(_", "\\u", "JS", "API", "\\u", "PATH_", ")_", "._", "read_", "(_", ")_", ")_", "\\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, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Use of the return value of a procedure
CGATOxford/cgat/scripts/cgat_get_options.py
[ { "content": "'''\ncgat_get_options.py - build a sorted list of all options used in scripts\n========================================================================\n\n:Author:\n:Release: $Id$\n:Date: |today|\n:Tags: Python\n\nPurpose\n-------\n\nGo through all scripts in the CGAT code collection and collect\noptions used in the scripts.\n\nThis script expects to be executed at the root of the\nCGAT code repository.\n\n\nUsage\n-----\n\n.. Example use case\n\nExample::\n\n python cgat_get_options.py\n\nType::\n\n python cgat_get_options.py --help\n\nfor command line help.\n\nCommand line options\n--------------------\n\n'''\n\nimport sys\nimport os\nimport glob\nimport imp\nimport collections\nimport pandas\nimport CGAT.Experiment as E\nimport CGAT.IOTools as IOTools\n\n# handle to original E.Start function\nORIGINAL_START = None\n\n# Parser object collected from child script\nPARSER = None\n\n# DIRECTORIES to examine for python modules/scripts\nEXPRESSIONS = (\n ('scripts', 'scripts/*.py'),)\n# ('optic', 'scripts/optic/*.py'),\n# ('gpipe', 'scripts/gpipe/*.py'))\n\n# scripts to exclude from collection\nEXCLUDE = (\"__init__.py\",\n \"cgat.py\",)\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n sys.exit(main(sys.argv))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def main(argv=None):\n \"\"\"script main.\n parses command line options in sys.argv, unless *argv* is given.\n \"\"\"\n\n if argv is None:\n argv = sys.argv\n\n # setup command line parser\n parser = E.OptionParser(version=\"%prog version: $Id$\",\n usage=globals()[\"__doc__\"])\n\n parser.add_option(\n \"--inplace\", dest=\"inplace\", action=\"store_true\",\n help=\"update option list in place. New options will\"\n \"be added to the list given by --options-tsv-file. \"\n \"Options will only be added, not removed [%default]\")\n\n parser.add_option(\n \"--options-tsv-file\", dest=\"tsv_file\", type=\"string\",\n help=\"existing table with options. Will be updated if \"\n \"--in-place is set [default]\")\n\n parser.set_defaults(\n inplace=False,\n tsv_file=None)\n\n # add common options (-h/--help, ...) and parse command line\n (options, args) = E.Start(parser, argv=argv)\n\n old_options = None\n if options.tsv_file:\n if not os.path.exists(options.tsv_file):\n raise OSError(\n \"filename %s not found, see --options-tsv-file\" %\n options.tsv_file)\n old_options = pandas.read_csv(\n IOTools.openFile(options.tsv_file),\n sep=\"\\t\",\n index_col=0,\n )\n old_options = old_options.fillna(\"\")\n\n global ORIGINAL_START\n ORIGINAL_START = E.Start\n\n all_options = collections.defaultdict(list)\n\n for label, expression in EXPRESSIONS:\n\n files = glob.glob(expression)\n files.sort()\n\n for f in files:\n\n E.debug(\"processing %s\" % f)\n if os.path.isdir(f):\n continue\n if os.path.basename(f) in EXCLUDE:\n continue\n collected_options = collectOptionsFromScript(os.path.abspath(f))\n for o in collected_options:\n all_options[o].append(f)\n\n # add old options\n for x in old_options.index:\n if x not in all_options:\n all_options[x].append(\"--\")\n\n if options.inplace:\n outfile = IOTools.openFile(options.tsv_file, \"w\")\n E.info(\"updating file '%s'\" % options.tsv_file)\n else:\n outfile = options.stdout\n\n outfile.write(\"option\\taction\\tcomment\\talternative\\tfiles\\n\")\n for o, v in sorted(all_options.items()):\n try:\n action, comment, alternative, ff = old_options.xs(o)\n\n except KeyError:\n action, comment, alternative, ff = \"\", \"\", \"\", \"\"\n\n if comment == \"nan\":\n comment = \"\"\n if alternative == \"nan\":\n alternative = \"\"\n\n outfile.write(\"\\t\".join((map(\n str, (o, action, comment, alternative, \",\".join(v))))) + \"\\n\")\n\n if outfile != options.stdout:\n outfile.close()\n\n # write footer and output benchmark information.\n E.Stop()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 130 } ]
[ { "span": "main(sys.argv))", "start_line": 228, "start_column": 13, "end_line": 228, "end_column": 27 } ]
[ { "span": "def main(argv=None):", "start_line": 130, "start_column": 0, "end_line": 130, "end_column": 20 } ]
1
false
[ "[CLS]_", "Use_", "of_", "the_", "return_", "value_", "of_", "a_", "procedure_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "cg", "at", "\\u", "get", "\\u", "options", ".", "py", " ", "-", " ", "build", " ", "a", " ", "sorte", "d", " ", "list", " ", "of", " ", "all", " ", "options", " ", "used", " ", "in", " ", "scripts", "\\", "10", ";", "==============", "==============", "==============", "==============", "==============", "==", "\\", "10", ";", "\\", "10", ";", ":", "Author", ":", "\\", "10", ";", ":", "Release", ":", " ", "$", "Id", "$", "\\", "10", ";", ":", "Date", ":", " ", "|", "toda", "y", "|", "\\", "10", ";", ":", "Ta", "gs", ":", " ", "Pyth", "on", "\\", "10", ";", "\\", "10", ";", "Pur", "pose", "\\", "10", ";", "-------", "\\", "10", ";", "\\", "10", ";", "Go", " ", "through", " ", "all", " ", "scripts", " ", "in", " ", "the", " ", "CGA", "T", " ", "code", " ", "collection", " ", "and", " ", "collect", "\\", "10", ";", "options", " ", "used", " ", "in", " ", "the", " ", "scripts", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "script", " ", "expect", "s", " ", "to", " ", "be", " ", "executed", " ", "at", " ", "the", " ", "root", " ", "of", " ", "the", "\\", "10", ";", "CGA", "T", " ", "code", " ", "repos", "itor", "y", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "Us", "age", "\\", "10", ";", "-----", "\\", "10", ";", "\\", "10", ";", "..", " ", "Exam", "ple", " ", "use", " ", "case", "\\", "10", ";", "\\", "10", ";", "Exam", "ple", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "python", " ", "cg", "at", "\\u", "get", "\\u", "options", ".", "py", "\\", "10", ";", "\\", "10", ";", "Type", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "python", " ", "cg", "at", "\\u", "get", "\\u", "options", ".", "py", " ", "--", "help", "\\", "10", ";", "\\", "10", ";", "for", " ", "command", " ", "line", " ", "help", ".", "\\", "10", ";", "\\", "10", ";", "Command", " ", "line", " ", "options", "\\", "10", ";", "--------------", "------", "\\", "10", ";", "\\", "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_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "imp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pandas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGA", "T_", "._", "Experiment_", "as_", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGA", "T_", "._", "IO", "Tools_", "as_", "IO", "Tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "handle", " ", "to", " ", "original", " ", "E", ".", "Start", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "ORIGIN", "AL", "\\u", "START_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Parser", " ", "object", " ", "collected", " ", "from", " ", "child", " ", "script_", "\\u\\u\\uNL\\u\\u\\u_", "PARSER_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DIRECT", "ORIE", "S", " ", "to", " ", "examine", " ", "for", " ", "python", " ", "module", "s", "/", "scripts_", "\\u\\u\\uNL\\u\\u\\u_", "EXPR", "ESSION", "S_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "scripts", "'_", ",_", "'", "scripts", "/*", ".", "py", "'_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "('", "optic", "',", " ", "'", "scripts", "/", "optic", "/*", ".", "py", "')", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "('", "gpi", "pe", "',", " ", "'", "scripts", "/", "gpi", "pe", "/*", ".", "py", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "scripts", " ", "to", " ", "exclu", "de", " ", "from", " ", "collection_", "\\u\\u\\uNL\\u\\u\\u_", "EXCLUDE", "_", "=_", "(_", "\"\\u\\u", "init", "\\u\\u", ".", "py", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cg", "at", ".", "py", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "main_", "(_", "sys_", "._", "argv_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", "argv_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "script", " ", "main", ".", "\\", "10", ";", " ", " ", " ", " ", "parse", "s", " ", "command", " ", "line", " ", "options", " ", "in", " ", "sys", ".", "argv", ",", " ", "unl", "ess", " ", "*", "argv", "*", " ", "is", " ", "give", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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\\uNL\\u\\u\\u_", "#", " ", "setup", " ", "command", " ", "line", " ", "parser_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parser_", "=_", "E_", "._", "Optio", "n", "Parser_", "(_", "version_", "=_", "\"%", "prog", " ", "version", ":", " ", "$", "Id", "$\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "usage_", "=_", "globals_", "(_", ")_", "[_", "\"\\u\\u", "doc", "\\u\\u\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "inpla", "ce", "\"_", ",_", "dest_", "=_", "\"", "inpla", "ce", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "update", " ", "option", " ", "list", " ", "in", " ", "place", ".", " ", "New", " ", "options", " ", "will", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "be", " ", "adde", "d", " ", "to", " ", "the", " ", "list", " ", "give", "n", " ", "by", " ", "--", "options", "-", "tsv", "-", "file", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Optio", "ns", " ", "will", " ", "only", " ", "be", " ", "adde", "d", ",", " ", "not", " ", "remove", "d", " ", "[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "options", "-", "tsv", "-", "file", "\"_", ",_", "dest_", "=_", "\"", "tsv", "\\u", "file", "\"_", ",_", "type_", "=_", "\"", "string", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "exist", "ing", " ", "table", " ", "with", " ", "options", ".", " ", "Wil", "l", " ", "be", " ", "update", "d", " ", "if", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "in", "-", "place", " ", "is", " ", "set", " ", "[", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "set\\u", "defaults_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "inplace_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsv", "\\u", "file_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "common", " ", "options", " ", "(-", "h", "/--", "help", ",", " ", "...)", " ", "and", " ", "parse", " ", "command", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "options_", ",_", "args_", ")_", "=_", "E_", "._", "Start_", "(_", "parser_", ",_", "argv_", "=_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "options_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "tsv", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "options_", "._", "tsv", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "OSE", "rror_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "filename", " ", "%", "s", " ", "not", " ", "found", ",", " ", "see", " ", "--", "options", "-", "tsv", "-", "file", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "tsv", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "options_", "=_", "pandas_", "._", "read", "\\u", "csv_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IO", "Tools_", "._", "open", "File_", "(_", "options_", "._", "tsv", "\\u", "file_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sep_", "=_", "\"\\\\", "t", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index", "\\u", "col_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "options_", "=_", "old", "\\u", "options_", "._", "fillna_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global_", "ORIGIN", "AL", "\\u", "START_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ORIGIN", "AL", "\\u", "START_", "=_", "E_", "._", "Start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "options_", "=_", "collections_", "._", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "label_", ",_", "expression_", "in_", "EXPR", "ESSION", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "files_", "=_", "glob_", "._", "glob_", "(_", "expression_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "f_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "E_", "._", "debug_", "(_", "\"", "process", "ing", " ", "%", "s", "\"_", "%_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "f_", ")_", ":_", "\\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_", "os_", "._", "path_", "._", "basename_", "(_", "f_", ")_", "in_", "EXCLUDE", "_", ":_", "\\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_", "collected", "\\u", "options_", "=_", "collect", "Optio", "ns", "Fro", "m", "Script_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "o_", "in_", "collected", "\\u", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "options_", "[_", "o_", "]_", "._", "append_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "old", " ", "options_", "\\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_", "x_", "in_", "old", "\\u", "options_", "._", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "not_", "in_", "all", "\\u", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "options_", "[_", "x_", "]_", "._", "append_", "(_", "\"--\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "inplace_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outfile_", "=_", "IO", "Tools_", "._", "open", "File_", "(_", "options_", "._", "tsv", "\\u", "file_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "E_", "._", "info_", "(_", "\"", "updat", "ing", " ", "file", " ", "'%", "s", "'\"_", "%_", "options_", "._", "tsv", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outfile_", "=_", "options_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outfile_", "._", "write_", "(_", "\"", "option", "\\\\", "tac", "tion", "\\\\", "tco", "mmen", "t", "\\\\", "tal", "tern", "ative", "\\\\", "tfi", "les", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "o_", ",_", "v_", "in_", "sorted_", "(_", "all", "\\u", "options_", "._", "items_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action_", ",_", "comment_", ",_", "alternative", "_", ",_", "ff_", "=_", "old", "\\u", "options_", "._", "xs_", "(_", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action_", ",_", "comment_", ",_", "alternative", "_", ",_", "ff_", "=_", "\"\"_", ",_", "\"\"_", ",_", "\"\"_", ",_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "comment_", "==_", "\"", "nan", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comment_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "alternative", "_", "==_", "\"", "nan", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alternative", "_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outfile_", "._", "write_", "(_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "(_", "map_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "str_", ",_", "(_", "o_", ",_", "action_", ",_", "comment_", ",_", "alternative", "_", ",_", "\",\"_", "._", "join_", "(_", "v_", ")_", ")_", ")_", ")_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "outfile_", "!=_", "options_", "._", "stdout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "footer", " ", "and", " ", "output", " ", "bench", "mark", " ", "informati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "E_", "._", "Stop_", "(_", ")_", "\\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,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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 ]
Module is imported more than once
joaoqalves/web2py-oauth2/models/utils.py
[ { "content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport dateutil.parser, datetime\nfrom bson.objectid import ObjectId\nfrom gluon.custom_import import track_changes\nfrom oauth import OAuth2\nfrom oauth.storage import web2pyStorage as storage # change to MongoStorage if you aren't using DAL\nfrom oauth.exceptions import *\ntrack_changes(True)\n\nCODES = {'ok': 200}\nMESSAGES = {'ok': 'success'}\n\n \n \n \n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def encode_model(obj, recursive=False):\n if obj is None:\n return obj\n\n import bson\n import datetime\n\n if isinstance(obj, (int, float, basestring)):\n out = obj\n elif isinstance(obj, list):\n out = [encode_model(item) for item in obj]\n elif isinstance(obj, dict):\n out = dict([(k, encode_model(v)) for (k, v) in obj.items()])\n elif isinstance(obj, (datetime.datetime, datetime.timedelta)):\n out = str(obj)\n elif isinstance(obj, bson.objectid.ObjectId):\n out = {'ObjectId': str(obj)}\n else:\n raise NameError(\"Could not JSON-encode type '%s': %s\" % (type(obj), str(obj)))\n\n return out", "metadata": "root.encode_model", "header": "['module', '___EOS___']", "index": 48 } ]
[ { "span": "import datetime", "start_line": 53, "start_column": 4, "end_line": 53, "end_column": 19 } ]
[ { "span": "import dateutil.parser, datetime", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 32 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "dateutil_", "._", "parser_", ",_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bson_", "._", "objectid", "_", "import_", "Object", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "custom", "\\u", "import_", "import_", "track", "\\u", "changes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oauth_", "import_", "OA", "uth", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oauth_", "._", "storage_", "import_", "web", "2py", "Storage_", "as_", "storage_", "#", " ", "change", " ", "to", " ", "Mon", "go", "Stor", "age", " ", "if", " ", "you", " ", "are", "n", "'", "t", " ", "usi", "ng", " ", "DA", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oauth_", "._", "exceptions_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "track", "\\u", "changes_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CODES_", "=_", "{_", "'", "ok", "'_", ":_", "200_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MESSAGES_", "=_", "{_", "'", "ok", "'_", ":_", "'", "success", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "encode", "\\u", "model_", "(_", "obj_", ",_", "recursive_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "bson_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "obj_", ",_", "(_", "int_", ",_", "float_", ",_", "basestring_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "obj_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "[_", "encode", "\\u", "model_", "(_", "item_", ")_", "for_", "item_", "in_", "obj_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "obj_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "dict_", "(_", "[_", "(_", "k_", ",_", "encode", "\\u", "model_", "(_", "v_", ")_", ")_", "for_", "(_", "k_", ",_", "v_", ")_", "in_", "obj_", "._", "items_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "obj_", ",_", "(_", "datetime_", "._", "datetime_", ",_", "datetime_", "._", "timedelta_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "str_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "obj_", ",_", "bson_", "._", "objectid", "_", "._", "Object", "Id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "{_", "'", "Object", "Id", "'_", ":_", "str_", "(_", "obj_", ")_", "}_", "\\u\\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_", "Name", "Error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "JSO", "N", "-", "encode", " ", "type", " ", "'%", "s", "':", " ", "%", "s", "\"_", "%_", "(_", "type_", "(_", "obj_", ")_", ",_", "str_", "(_", "obj_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "out_" ]
[ 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
Narcolapser/python-o365/examples/EmailPrinting/printing.py
[ { "content": "\tdef setFlag(self,flag,value):\n\t\tif flag == 'd':\n\t\t\treturn False\n\t\ttry:\n\t\t\tself.flags[flag] = value\n\t\texcept:\n\t\t\treturn False\n\t\treturn True", "metadata": "root.Printer.setFlag", "header": "['class', 'Printer', '(', 'object', ')', ':', '___EOS___']", "index": 32 }, { "content": "\tdef getFlag(self,flag):\n\t\ttry:\n\t\t\treturn self.flags[flag]\n\t\texcept:\n\t\t\treturn False", "metadata": "root.Printer.getFlag", "header": "['class', 'Printer', '(', 'object', ')', ':', '___EOS___']", "index": 42 } ]
[ { "span": "except:", "start_line": 37, "start_column": 2, "end_line": 37, "end_column": 9 }, { "span": "except:", "start_line": 45, "start_column": 2, "end_line": 45, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Printer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Flag_", "(_", "self_", ",_", "flag_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "flag_", "==_", "'", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "False_", "\\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\t", "\t\t_", "self_", "._", "flags_", "[_", "flag_", "]_", "=_", "value_", "\\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_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Printer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Flag_", "(_", "self_", ",_", "flag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "self_", "._", "flags_", "[_", "flag_", "]_", "\\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_", "return_", "False_", "\\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, 0, 1, 1, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2 ]
Unused import
algorhythms/HackerRankAlgorithms/Lego Blocks.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\nProblem Statement\n\nYou have 4 types of lego blocks, of sizes (1 x 1 x 1), (1 x 1 x 2), (1 x 1 x 3), and (1 x 1 x 4). Assume that you have\nan infinite number of blocks of each type.\n\nUsing these blocks, you want to make a wall of height N and width M. The wall should not have any holes in it. The wall\nyou build should be one solid structure. A solid structure can be interpreted in one of the following ways:\n\n(1)It should not be possible to separate the wall along any vertical line without cutting any lego block used to build\nthe wall.\n(2)You cannot make a vertical cut from top to bottom without cutting one or more lego blocks.\n\nThe blocks can only be placed horizontally. In how many ways can the wall be built?\n\"\"\"\n__author__ = 'Danyang'\nMOD = 1000000007\n\n\n\n\n\n\nif __name__ == \"__main__\":\n import sys\n\n f = open(\"0.in\", \"r\")\n # f = sys.stdin\n solution = Solution()\n testcases = int(f.readline().strip())\n\n for t in xrange(testcases):\n # construct cipher\n cipher = map(int, f.readline().strip().split(' '))\n\n # solve\n s = \"%s\\n\" % (solution.solve(cipher))\n print s,\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Solution(object):\n", "metadata": "root.Solution", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def __init__(self):\n self.lens = [1, 2, 3, 4]", "metadata": "root.Solution.__init__", "header": "['class', 'Solution', '(', 'object', ')', ':', '___EOS___']", "index": 21 }, { "content": " def solve(self, cipher):\n \"\"\"\n f[i][j] represents the number of combinations for size i*j wall, not necessarily solid\n f[i][j] = f[1][j]**i\n\n s[i][j] represents the number of combinations for size i*j wall, solid\n\n s[h][w] = f(h,w) - sum(f[h][w-i]*s[h][i] for i)\n\n To solve TLE:\n 1. s[h][w] not rely on previous h, simplify to s[w]\n 2. power takes time, take memory to save time for f[1][j]**i\n\n :param cipher:\n :return:\n \"\"\"\n N, M = cipher\n f = [0 for _ in xrange(M + 1)]\n s = [0 for _ in xrange(M + 1)]\n\n f[0] = 1\n for j in xrange(1, M + 1):\n for l in self.lens:\n if j - l >= 0:\n f[j] += f[j - l]\n f[j] %= MOD\n\n f_N = map(lambda x: pow(x, N, MOD), f)\n\n for j in xrange(1, M + 1):\n s[j] = f_N[j]\n if s[j] <= 0: break\n for k in xrange(1, j): # sum\n s[j] -= f_N[j - k] * s[k]\n s[j] %= MOD\n return s[M]", "metadata": "root.Solution.solve", "header": "['class', 'Solution', '(', 'object', ')', ':', '___EOS___']", "index": 24 }, { "content": "class Solution_TLE(object):\n\n", "metadata": "root.Solution_TLE", "header": "['module', '___EOS___']", "index": 62 }, { "content": " def __init__(self):\n self.lens = [1, 2, 3, 4]", "metadata": "root.Solution_TLE.__init__", "header": "['class', 'Solution_TLE', '(', 'object', ')', ':', '___EOS___']", "index": 63 }, { "content": " def solve(self, cipher):\n \"\"\"\n f[i][j] represents the number of combinations for size i*j, not necessarily solid\n f[i][j] = f[1][j]**i\n s[i][j] represents the number of combinations for size i*j, solid\n\n s[h][w] = f(h,w) - sum(f[h][w-i]*s[h][i])\n\n be careful with TLE\n :param cipher:\n :return:\n \"\"\"\n N, M = cipher\n f = [[0 for _ in xrange(M + 1)] for _ in xrange(N + 1)]\n s = [[0 for _ in xrange(M + 1)] for _ in xrange(N + 1)]\n\n f[1][0] = 1\n for j in xrange(1, M + 1):\n for l in self.lens:\n if j - l >= 0:\n f[1][j] += f[1][j - l]\n f[1][j] %= MOD\n\n for i in xrange(2, N + 1):\n for j in xrange(1, M + 1):\n f[i][j] = f[i - 1][j] * f[1][j]\n f[i][j] %= MOD\n\n for i in xrange(1, N + 1):\n for j in xrange(1, M + 1):\n s[i][j] = f[i][j]\n if s[i][j] <= 0: break\n for k in xrange(1, j): # sum\n s[i][j] -= f[i][j - k] * s[i][k]\n s[i][j] %= MOD\n return s[N][M]", "metadata": "root.Solution_TLE.solve", "header": "['class', 'Solution_TLE', '(', 'object', ')', ':', '___EOS___']", "index": 66 }, { "content": " def solve_error(self, cipher):\n \"\"\"\n f[i][j] represents the number of combinations for size i*j\n f[i][j+1] = iC1*f[i-1][j]*f[1][j+1]\n = iC2*f[i-2][j]*f[1][j+1]^2\n ...\n (need careful math proof of the equivalent points\n :param cipher: the cipher\n \"\"\"\n N, M = cipher\n f = [[0 for _ in xrange(M + 1)] for _ in xrange(N + 1)]\n\n f[1][1] = 1\n for j in xrange(1, M + 1):\n for l in self.lens:\n if j - l >= 1:\n f[1][j] += f[1][j - l]\n for j in xrange(1, M + 1):\n f[1][j] -= f[1][j - 1]\n\n for i in xrange(2, N + 1):\n for j in xrange(1, M + 1):\n cmb = i\n for l in xrange(1, i + 1):\n f[i][j] += cmb * f[i - l][j - 1] * (f[1][j] ** i) # equivalent\n cmb = cmb * (i - l) / (l + 1)\n return f[N][M]", "metadata": "root.Solution_TLE.solve_error", "header": "['class', 'Solution_TLE', '(', 'object', ')', ':', '___EOS___']", "index": 103 } ]
[ { "span": "import sys", "start_line": 133, "start_column": 4, "end_line": 133, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Prob", "lem", " ", "State", "ment", "\\", "10", ";", "\\", "10", ";", "You", " ", "have", " ", "4", " ", "types", " ", "of", " ", "leg", "o", " ", "blocks", ",", " ", "of", " ", "size", "s", " ", "(", "1", " ", "x", " ", "1", " ", "x", " ", "1", "),", " ", "(", "1", " ", "x", " ", "1", " ", "x", " ", "2", "),", " ", "(", "1", " ", "x", " ", "1", " ", "x", " ", "3", "),", " ", "and", " ", "(", "1", " ", "x", " ", "1", " ", "x", " ", "4", ").", " ", "Assume", " ", "tha", "t", " ", "you", " ", "have", "\\", "10", ";", "an", " ", "infini", "te", " ", "number", " ", "of", " ", "blocks", " ", "of", " ", "each", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", "Us", "ing", " ", "these", " ", "blocks", ",", " ", "you", " ", "want", " ", "to", " ", "make", " ", "a", " ", "wall", " ", "of", " ", "height", " ", "N", " ", "and", " ", "widt", "h", " ", "M", ".", " ", "The", " ", "wall", " ", "shou", "ld", " ", "not", " ", "have", " ", "any", " ", "hole", "s", " ", "in", " ", "it", ".", " ", "The", " ", "wall", "\\", "10", ";", "you", " ", "build", " ", "shou", "ld", " ", "be", " ", "one", " ", "solid", " ", "structure", ".", " ", "A", " ", "solid", " ", "structure", " ", "can", " ", "be", " ", "interprete", "d", " ", "in", " ", "one", " ", "of", " ", "the", " ", "follow", "ing", " ", "way", "s", ":", "\\", "10", ";", "\\", "10", ";", "(", "1", ")", "It", " ", "shou", "ld", " ", "not", " ", "be", " ", "possib", "le", " ", "to", " ", "separate", " ", "the", " ", "wall", " ", "along", " ", "any", " ", "vertical", " ", "line", " ", "with", "out", " ", "cutt", "ing", " ", "any", " ", "leg", "o", " ", "block", " ", "used", " ", "to", " ", "build", "\\", "10", ";", "the", " ", "wall", ".", "\\", "10", ";", "(", "2", ")", "You", " ", "cann", "ot", " ", "make", " ", "a", " ", "vertical", " ", "cut", " ", "from", " ", "top", " ", "to", " ", "bottom", " ", "with", "out", " ", "cutt", "ing", " ", "one", " ", "or", " ", "more", " ", "leg", "o", " ", "blocks", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "blocks", " ", "can", " ", "only", " ", "be", " ", "place", "d", " ", "horizon", "tally", ".", " ", "In", " ", "how", " ", "many", " ", "way", "s", " ", "can", " ", "the", " ", "wall", " ", "be", " ", "bui", "lt", "?", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "Dan", "yan", "g", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MOD", "_", "=_", "100000000", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "open_", "(_", "\"", "0.", "in", "\"_", ",_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "f", " ", "=", " ", "sys", ".", "stdin_", "\\u\\u\\uNL\\u\\u\\u_", "solution_", "=_", "Solution_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testcases", "_", "=_", "int_", "(_", "f_", "._", "readline_", "(_", ")_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "xrange_", "(_", "testcases", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "construct", " ", "cipher_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cipher_", "=_", "map_", "(_", "int_", ",_", "f_", "._", "readline_", "(_", ")_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "'", " ", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "solve_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "\"%", "s", "\\\\", "n", "\"_", "%_", "(_", "solution_", "._", "solve_", "(_", "cipher_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "s_", ",_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Solution_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Solution_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lens_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Solution_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "solve_", "(_", "self_", ",_", "cipher_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "f", "[", "i", "][", "j", "]", " ", "represent", "s", " ", "the", " ", "number", " ", "of", " ", "combinat", "ion", "s", " ", "for", " ", "size", " ", "i", "*", "j", " ", "wall", ",", " ", "not", " ", "necessar", "il", "y", " ", "solid", "\\", "10", ";", " ", " ", " ", " ", "f", "[", "i", "][", "j", "]", " ", "=", " ", "f", "[", "1", "][", "j", "]*", "*", "i", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "s", "[", "i", "][", "j", "]", " ", "represent", "s", " ", "the", " ", "number", " ", "of", " ", "combinat", "ion", "s", " ", "for", " ", "size", " ", "i", "*", "j", " ", "wall", ",", " ", "solid", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "s", "[", "h", "][", "w", "]", " ", " ", "=", " ", "f", "(", "h", ",", "w", ")", " ", "-", " ", "sum", "(", "f", "[", "h", "][", "w", "-", "i", "]*", "s", "[", "h", "][", "i", "]", " ", "for", " ", "i", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "solve", " ", "TLE", ":", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "s", "[", "h", "][", "w", "]", " ", "not", " ", "rely", " ", "on", " ", "previ", "ous", " ", "h", ",", " ", "simplify", " ", "to", " ", "s", "[", "w", "]", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "power", " ", "take", "s", " ", "time", ",", " ", "take", " ", "memory", " ", "to", " ", "save", " ", "time", " ", "for", " ", "f", "[", "1", "][", "j", "]*", "*", "i", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "cipher", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "N_", ",_", "M_", "=_", "cipher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "[_", "0_", "for_", "\\u_", "in_", "xrange_", "(_", "M_", "+_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "[_", "0_", "for_", "\\u_", "in_", "xrange_", "(_", "M_", "+_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "[_", "0_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "xrange_", "(_", "1_", ",_", "M_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "l_", "in_", "self_", "._", "lens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "j_", "-_", "l_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "[_", "j_", "]_", "+=_", "f_", "[_", "j_", "-_", "l_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "[_", "j_", "]_", "%=_", "MOD", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "\\u", "N_", "=_", "map_", "(_", "lambda_", "x_", ":_", "pow_", "(_", "x_", ",_", "N_", ",_", "MOD", "_", ")_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "j_", "in_", "xrange_", "(_", "1_", ",_", "M_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "[_", "j_", "]_", "=_", "f", "\\u", "N_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "[_", "j_", "]_", "<=_", "0_", ":_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "xrange_", "(_", "1_", ",_", "j_", ")_", ":_", "#", " ", "sum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "[_", "j_", "]_", "-=_", "f", "\\u", "N_", "[_", "j_", "-_", "k_", "]_", "*_", "s_", "[_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "[_", "j_", "]_", "%=_", "MOD", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "s_", "[_", "M_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Solut", "ion", "\\u", "TLE", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Solut", "ion", "\\u", "TLE", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lens_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Solut", "ion", "\\u", "TLE", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "solve_", "(_", "self_", ",_", "cipher_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "f", "[", "i", "][", "j", "]", " ", "represent", "s", " ", "the", " ", "number", " ", "of", " ", "combinat", "ion", "s", " ", "for", " ", "size", " ", "i", "*", "j", ",", " ", "not", " ", "necessar", "il", "y", " ", "solid", "\\", "10", ";", " ", " ", " ", " ", "f", "[", "i", "][", "j", "]", " ", "=", " ", "f", "[", "1", "][", "j", "]*", "*", "i", "\\", "10", ";", " ", " ", " ", " ", "s", "[", "i", "][", "j", "]", " ", "represent", "s", " ", "the", " ", "number", " ", "of", " ", "combinat", "ion", "s", " ", "for", " ", "size", " ", "i", "*", "j", ",", " ", "solid", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "s", "[", "h", "][", "w", "]", " ", " ", "=", " ", "f", "(", "h", ",", "w", ")", " ", "-", " ", "sum", "(", "f", "[", "h", "][", "w", "-", "i", "]*", "s", "[", "h", "][", "i", "])", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "care", "ful", " ", "with", " ", "TLE", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "cipher", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "N_", ",_", "M_", "=_", "cipher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "[_", "[_", "0_", "for_", "\\u_", "in_", "xrange_", "(_", "M_", "+_", "1_", ")_", "]_", "for_", "\\u_", "in_", "xrange_", "(_", "N_", "+_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "[_", "[_", "0_", "for_", "\\u_", "in_", "xrange_", "(_", "M_", "+_", "1_", ")_", "]_", "for_", "\\u_", "in_", "xrange_", "(_", "N_", "+_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "[_", "1_", "]_", "[_", "0_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "xrange_", "(_", "1_", ",_", "M_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "l_", "in_", "self_", "._", "lens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "j_", "-_", "l_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "[_", "1_", "]_", "[_", "j_", "]_", "+=_", "f_", "[_", "1_", "]_", "[_", "j_", "-_", "l_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "[_", "1_", "]_", "[_", "j_", "]_", "%=_", "MOD", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "2_", ",_", "N_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "xrange_", "(_", "1_", ",_", "M_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "[_", "i_", "]_", "[_", "j_", "]_", "=_", "f_", "[_", "i_", "-_", "1_", "]_", "[_", "j_", "]_", "*_", "f_", "[_", "1_", "]_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "[_", "i_", "]_", "[_", "j_", "]_", "%=_", "MOD", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "1_", ",_", "N_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "xrange_", "(_", "1_", ",_", "M_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "[_", "i_", "]_", "[_", "j_", "]_", "=_", "f_", "[_", "i_", "]_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "[_", "i_", "]_", "[_", "j_", "]_", "<=_", "0_", ":_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "xrange_", "(_", "1_", ",_", "j_", ")_", ":_", "#", " ", "sum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "s_", "[_", "i_", "]_", "[_", "j_", "]_", "-=_", "f_", "[_", "i_", "]_", "[_", "j_", "-_", "k_", "]_", "*_", "s_", "[_", "i_", "]_", "[_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "[_", "i_", "]_", "[_", "j_", "]_", "%=_", "MOD", "_", "\\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_", "s_", "[_", "N_", "]_", "[_", "M_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Solut", "ion", "\\u", "TLE", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "solve", "\\u", "error_", "(_", "self_", ",_", "cipher_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "f", "[", "i", "][", "j", "]", " ", "represent", "s", " ", "the", " ", "number", " ", "of", " ", "combinat", "ion", "s", " ", "for", " ", "size", " ", "i", "*", "j", "\\", "10", ";", " ", " ", " ", " ", "f", "[", "i", "][", "j", "+", "1", "]", " ", "=", " ", "i", "C1", "*", "f", "[", "i", "-1", "][", "j", "]*", "f", "[", "1", "][", "j", "+", "1", "]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "=", " ", "i", "C2", "*", "f", "[", "i", "-", "2", "][", "j", "]*", "f", "[", "1", "][", "j", "+", "1", "]", "^", "2", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "(", "need", " ", "care", "ful", " ", "math", " ", "proof", " ", "of", " ", "the", " ", "equivalent", " ", "points", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "cipher", ":", " ", "the", " ", "cipher", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "N_", ",_", "M_", "=_", "cipher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "[_", "[_", "0_", "for_", "\\u_", "in_", "xrange_", "(_", "M_", "+_", "1_", ")_", "]_", "for_", "\\u_", "in_", "xrange_", "(_", "N_", "+_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "[_", "1_", "]_", "[_", "1_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "xrange_", "(_", "1_", ",_", "M_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "l_", "in_", "self_", "._", "lens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "j_", "-_", "l_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "[_", "1_", "]_", "[_", "j_", "]_", "+=_", "f_", "[_", "1_", "]_", "[_", "j_", "-_", "l_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "j_", "in_", "xrange_", "(_", "1_", ",_", "M_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "[_", "1_", "]_", "[_", "j_", "]_", "-=_", "f_", "[_", "1_", "]_", "[_", "j_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "2_", ",_", "N_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "xrange_", "(_", "1_", ",_", "M_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmb", "_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "l_", "in_", "xrange_", "(_", "1_", ",_", "i_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "[_", "i_", "]_", "[_", "j_", "]_", "+=_", "cmb", "_", "*_", "f_", "[_", "i_", "-_", "l_", "]_", "[_", "j_", "-_", "1_", "]_", "*_", "(_", "f_", "[_", "1_", "]_", "[_", "j_", "]_", "**_", "i_", ")_", "#", " ", "equivalent", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmb", "_", "=_", "cmb", "_", "*_", "(_", "i_", "-_", "l_", ")_", "/_", "(_", "l_", "+_",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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 ]
Unused local variable
apache/libcloud/libcloud/dns/drivers/cloudflare.py
[ { "content": " def request(self, action, params=None, data=None, headers=None,\n method='GET'):\n params = params or {}\n data = data or {}\n\n base_params = {\n 'email': self.user_id,\n 'tkn': self.key,\n 'a': action\n }\n params = copy.deepcopy(params)\n params.update(base_params)\n\n return super(CloudFlareDNSConnection, self).request(action=API_PATH,\n params=params,\n data=None,\n method=method,\n headers=headers)", "metadata": "root.CloudFlareDNSConnection.request", "header": "['class', 'CloudFlareDNSConnection', '(', 'ConnectionUserAndKey', ')', ':', '___EOS___']", "index": 105 } ]
[ { "span": "data ", "start_line": 108, "start_column": 8, "end_line": 108, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Cloud", "Fla", "re", "DNS", "Connection_", "(_", "Connect", "ion", "User", "And", "Key_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "request_", "(_", "self_", ",_", "action_", ",_", "params_", "=_", "None_", ",_", "data_", "=_", "None_", ",_", "headers_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "GET", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "params_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "data_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "self_", "._", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tk", "n", "'_", ":_", "self_", "._", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "a", "'_", ":_", "action_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "copy_", "._", "deepcopy_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "._", "update_", "(_", "base", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "super_", "(_", "Cloud", "Fla", "re", "DNS", "Connection_", ",_", "self_", ")_", "._", "request_", "(_", "action_", "=_", "API", "\\u", "PATH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
kleientertainment/ds_mod_tools/pkg/win32/Python27/Lib/unittest/case.py
[ { "content": " def run(self, result=None):\n orig_result = result\n if result is None:\n result = self.defaultTestResult()\n startTestRun = getattr(result, 'startTestRun', None)\n if startTestRun is not None:\n startTestRun()\n\n self._resultForDoCleanups = result\n result.startTest(self)\n\n testMethod = getattr(self, self._testMethodName)\n if (getattr(self.__class__, \"__unittest_skip__\", False) or\n getattr(testMethod, \"__unittest_skip__\", False)):\n # If the class or method was skipped.\n try:\n skip_why = (getattr(self.__class__, '__unittest_skip_why__', '')\n or getattr(testMethod, '__unittest_skip_why__', ''))\n self._addSkip(result, skip_why)\n finally:\n result.stopTest(self)\n return\n try:\n success = False\n try:\n self.setUp()\n except SkipTest as e:\n self._addSkip(result, str(e))\n except KeyboardInterrupt:\n raise\n except:\n result.addError(self, sys.exc_info())\n else:\n try:\n testMethod()\n except KeyboardInterrupt:\n raise\n except self.failureException:\n result.addFailure(self, sys.exc_info())\n except _ExpectedFailure as e:\n addExpectedFailure = getattr(result, 'addExpectedFailure', None)\n if addExpectedFailure is not None:\n addExpectedFailure(self, e.exc_info)\n else:\n warnings.warn(\"TestResult has no addExpectedFailure method, reporting as passes\",\n RuntimeWarning)\n result.addSuccess(self)\n except _UnexpectedSuccess:\n addUnexpectedSuccess = getattr(result, 'addUnexpectedSuccess', None)\n if addUnexpectedSuccess is not None:\n addUnexpectedSuccess(self)\n else:\n warnings.warn(\"TestResult has no addUnexpectedSuccess method, reporting as failures\",\n RuntimeWarning)\n result.addFailure(self, sys.exc_info())\n except SkipTest as e:\n self._addSkip(result, str(e))\n except:\n result.addError(self, sys.exc_info())\n else:\n success = True\n\n try:\n self.tearDown()\n except KeyboardInterrupt:\n raise\n except:\n result.addError(self, sys.exc_info())\n success = False\n\n cleanUpSuccess = self.doCleanups()\n success = success and cleanUpSuccess\n if success:\n result.addSuccess(self)\n finally:\n result.stopTest(self)\n if orig_result is None:\n stopTestRun = getattr(result, 'stopTestRun', None)\n if stopTestRun is not None:\n stopTestRun()", "metadata": "root.TestCase.run", "header": "['class', 'TestCase', '(', 'object', ')', ':', '___EOS___']", "index": 296 }, { "content": " def doCleanups(self):\n \"\"\"Execute all cleanup functions. Normally called for you after\n tearDown.\"\"\"\n result = self._resultForDoCleanups\n ok = True\n while self._cleanups:\n function, args, kwargs = self._cleanups.pop(-1)\n try:\n function(*args, **kwargs)\n except KeyboardInterrupt:\n raise\n except:\n ok = False\n result.addError(self, sys.exc_info())\n return ok", "metadata": "root.TestCase.doCleanups", "header": "['class', 'TestCase', '(', 'object', ')', ':', '___EOS___']", "index": 377 } ]
[ { "span": "except:", "start_line": 326, "start_column": 12, "end_line": 326, "end_column": 19 }, { "span": "except:", "start_line": 353, "start_column": 16, "end_line": 353, "end_column": 23 }, { "span": "except:", "start_line": 362, "start_column": 16, "end_line": 362, "end_column": 23 }, { "span": "except:", "start_line": 388, "start_column": 12, "end_line": 388, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "Case_", "(_", "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_", "run_", "(_", "self_", ",_", "result_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orig", "\\u", "result_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "default", "Test", "Result_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "Test", "Run_", "=_", "getattr_", "(_", "result_", ",_", "'", "start", "Test", "Run", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "start", "Test", "Run_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Test", "Run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "result", "For", "Do", "Clean", "ups_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "start", "Test_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test", "Method_", "=_", "getattr_", "(_", "self_", ",_", "self_", "._", "\\u", "test", "Meth", "od", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "getattr_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "\"\\u\\u", "unittest", "\\u", "skip", "\\u\\u\"_", ",_", "False_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "getattr_", "(_", "test", "Method_", ",_", "\"\\u\\u", "unittest", "\\u", "skip", "\\u\\u\"_", ",_", "False_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "class", " ", "or", " ", "method", " ", "was", " ", "skip", "ped", "._", "\\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 ", " _", "skip", "\\u", "why_", "=_", "(_", "getattr_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "'\\u", "\\u", "unittest", "\\u", "skip", "\\u", "wh", "y\\u\\u", "'_", ",_", "''_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "getattr_", "(_", "test", "Method_", ",_", "'\\u", "\\u", "unittest", "\\u", "skip", "\\u", "wh", "y\\u\\u", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "add", "Skip_", "(_", "result_", ",_", "skip", "\\u", "why_", ")_", "\\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 ", " _", "result_", "._", "stop", "Test_", "(_", "self_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Ski", "p", "Test_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "add", "Skip_", "(_", "result_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "add", "Error_", "(_", "self_", ",_", "sys_", "._", "exc", "\\u", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "test", "Method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "self_", "._", "fail", "ure", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "._", "add", "Failure_", "(_", "self_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "\\u", "Expect", "ed", "Failure_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "add", "Expect", "ed", "Failure_", "=_", "getattr_", "(_", "result_", ",_", "'", "add", "Expect", "ed", "Fail", "ure", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "add", "Expect", "ed", "Failure_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "add", "Expect", "ed", "Failure_", "(_", "self_", ",_", "e_", "._", "exc", "\\u", "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 ", " ", " _", "warnings_", "._", "warn_", "(_", "\"", "Test", "Result", " ", "has", " ", "no", " ", "add", "Expect", "ed", "Fail", "ure", " ", "method", ",", " ", "reporting", " ", "as", " ", "pass", "es", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Run", "time", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "add", "Success_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "\\u", "Une", "xpe", "cte", "d", "Success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "add", "Une", "xpe", "cte", "d", "Success_", "=_", "getattr_", "(_", "result_", ",_", "'", "add", "Une", "xpe", "cte", "d", "Success", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "add", "Une", "xpe", "cte", "d", "Success_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "add", "Une", "xpe", "cte", "d", "Success_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "warnings_", "._", "warn_", "(_", "\"", "Test", "Result", " ", "has", " ", "no", " ", "add", "Une", "xpe", "cte", "d", "Success", " ", "method", ",", " ", "reporting", " ", "as", " ", "fail", "ure", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Run", "time", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "add", "Failure_", "(_", "self_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Ski", "p", "Test_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "add", "Skip_", "(_", "result_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "._", "add", "Error_", "(_", "self_", ",_", "sys_", "._", "exc", "\\u", "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 ", " ", "_", "success_", "=_", "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 ", " ", "_", "self_", "._", "tear", "Down_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "._", "add", "Error_", "(_", "self_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "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_", "clean", "Up", "Success_", "=_", "self_", "._", "do", "Clean", "ups_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "success_", "and_", "clean", "Up", "Success_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "add", "Success_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "stop", "Test_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "orig", "\\u", "result_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stop", "Test", "Run_", "=_", "getattr_", "(_", "result_", ",_", "'", "stop", "Test", "Run", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stop", "Test", "Run_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "stop", "Test", "Run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "Clean", "ups_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Execut", "e", " ", "all", " ", "clean", "up", " ", "function", "s", ".", " ", "Normal", "ly", " ", "call", "ed", " ", "for", " ", "you", " ", "after", "\\", "10", ";", " ", " ", " ", " ", "tear", "Down", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "\\u", "result", "For", "Do", "Clean", "ups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "self_", "._", "\\u", "clean", "ups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "function_", ",_", "args_", ",_", "kwargs_", "=_", "self_", "._", "\\u", "clean", "ups_", "._", "pop_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "function_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\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 ", " _", "ok_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "add", "Error_", "(_", "self_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ok_", "\\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, 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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ooici/pyon/pyon/container/test/test_cc.py
[ { "content": "#!/usr/bin/env python\n\n__author__ = 'Dave Foster <[email protected]>'\n\nfrom pyon.util.int_test import IonIntegrationTestCase\nfrom pyon.util.unit_test import PyonTestCase\nfrom nose.plugins.attrib import attr\nfrom pyon.container.cc import Container, CCAP\nimport signal\nfrom gevent.event import Event\nfrom mock import Mock, patch, ANY\nfrom interface.services.icontainer_agent import ContainerAgentClient\nfrom interface.objects import ProcessStateEnum\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@attr('UNIT')\nclass TestCC(PyonTestCase):\n\n\n\n", "metadata": "root.TestCC", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def setUp(self):\n self.cc = Container()", "metadata": "root.TestCC.setUp", "header": "['class', 'TestCC', '(', 'PyonTestCase', ')', ':', '___EOS___']", "index": 16 }, { "content": " @patch('pyon.container.cc.log')\n @patch('pyon.container.cc.os')\n def test_fail_fast(self, osmock, logmock):\n self.cc.stop = Mock()\n\n self.cc.fail_fast('dippin dots')\n\n # make sure it called the things we expect\n self.assertIn('dippin dots', str(logmock.error.call_args_list[0]))\n self.cc.stop.assert_called_once_with()\n osmock.kill.assert_called_once_with(osmock.getpid(), signal.SIGTERM)", "metadata": "root.TestCC.test_fail_fast", "header": "['class', 'TestCC', '(', 'PyonTestCase', ')', ':', '___EOS___']", "index": 19 }, { "content": " @patch('pyon.container.cc.os')\n def test_fail_fast_no_stop(self, osmock):\n self.cc.stop = Mock()\n\n self.cc.fail_fast(\"icecream (of the future)\", True)\n self.assertEquals(self.cc.stop.call_count, 0)", "metadata": "root.TestCC.test_fail_fast_no_stop", "header": "['class', 'TestCC', '(', 'PyonTestCase', ')', ':', '___EOS___']", "index": 31 }, { "content": " def test_node_when_not_started(self):\n self.assertEquals(self.cc.node, None)", "metadata": "root.TestCC.test_node_when_not_started", "header": "['class', 'TestCC', '(', 'PyonTestCase', ')', ':', '___EOS___']", "index": 38 }, { "content": " def test_node_when_started(self):\n self.cc._capabilities.append(\"EXCHANGE_MANAGER\")\n self.cc.ex_manager = Mock()\n\n self.assertEquals(self.cc.node, self.cc.ex_manager.default_node)", "metadata": "root.TestCC.test_node_when_started", "header": "['class', 'TestCC', '(', 'PyonTestCase', ')', ':', '___EOS___']", "index": 41 }, { "content": "@attr('INT')\nclass TestCCInt(IonIntegrationTestCase):\n", "metadata": "root.TestCCInt", "header": "['module', '___EOS___']", "index": 47 }, { "content": " def test_start_hello(self):\n # start a service over messaging\n self._start_container()\n cc_client = ContainerAgentClient(node=self.container.node, name=self.container.name)\n\n p = cc_client.spawn_process('hello', 'examples.service.hello_service', 'HelloService')", "metadata": "root.TestCCInt.test_start_hello", "header": "['class', 'TestCCInt', '(', 'IonIntegrationTestCase', ')', ':', '___EOS___']", "index": 50 }, { "content": "@attr('INT')\nclass TestCCIntProcs(IonIntegrationTestCase):\n\n class ExpectedFailure(StandardError):\n pass\n\n", "metadata": "root.TestCCIntProcs", "header": "['module', '___EOS___']", "index": 57 }, { "content": " def setUp(self):\n # we don't want to connect to AMQP or do a pidfile or any of that jazz - just the proc manager please\n self.cc = Container()\n self.cc.resource_registry = Mock()\n self.cc.resource_registry.create.return_value=[\"ID\",\"rev\"]\n self.cc.event_pub = Mock()\n\n self.cc.proc_manager.start()\n\n self.cc.stop = Mock()\n self.cc.stop.side_effect = self.cc.proc_manager.stop", "metadata": "root.TestCCIntProcs.setUp", "header": "['class', 'TestCCIntProcs', '(', 'IonIntegrationTestCase', ')', ':', '___EOS___']", "index": 63 }, { "content": " def tearDown(self):\n pass", "metadata": "root.TestCCIntProcs.tearDown", "header": "['class', 'TestCCIntProcs', '(', 'IonIntegrationTestCase', ')', ':', '___EOS___']", "index": 75 }, { "content": "@attr('INT')\nclass TestContainerCapabilities(IonIntegrationTestCase):\n\n", "metadata": "root.TestContainerCapabilities", "header": "['module', '___EOS___']", "index": 78 }, { "content": " def test_development(self):\n from pyon.container.cc import CFG\n old_profile = CFG.container.profile\n CFG.container.profile = \"development\"\n try:\n self._start_container()\n self.assertIn(CCAP.RESOURCE_REGISTRY, self.container._capabilities)\n self.assertEquals(self.container._cap_instances[CCAP.RESOURCE_REGISTRY] .__class__.__name__, \"ResourceRegistry\")\n self.assertIn(CCAP.EVENT_REPOSITORY, self.container._capabilities)\n self.assertIn(CCAP.GOVERNANCE_CONTROLLER, self.container._capabilities)\n self.assertGreater(len(self.container._capabilities), 15)\n self.assertEqual(CFG.get_safe(\"container.messaging.server.primary\"), \"amqp\")\n finally:\n CFG.container.profile = old_profile", "metadata": "root.TestContainerCapabilities.test_development", "header": "['class', 'TestContainerCapabilities', '(', 'IonIntegrationTestCase', ')', ':', '___EOS___']", "index": 81 }, { "content": " def test_gumstix(self):\n from pyon.container.cc import CFG\n old_profile = CFG.container.profile\n CFG.container.profile = \"gumstix\"\n try:\n self._start_container()\n self.assertIn(CCAP.RESOURCE_REGISTRY, self.container._capabilities)\n self.assertEquals(self.container._cap_instances[CCAP.RESOURCE_REGISTRY] .__class__.__name__, \"EmbeddedResourceRegistryCapability\")\n self.assertNotIn(CCAP.EVENT_REPOSITORY, self.container._capabilities)\n self.assertNotIn(CCAP.GOVERNANCE_CONTROLLER, self.container._capabilities)\n self.assertLess(len(self.container._capabilities), 15)\n # This checks the config override\n # @TODO cannot check this here because container was not started with pycc.py\n #self.assertEqual(CFG.get_safe(\"container.messaging.server.primary\"), \"localrouter\")\n finally:\n CFG.container.profile = old_profile", "metadata": "root.TestContainerCapabilities.test_gumstix", "header": "['class', 'TestContainerCapabilities', '(', 'IonIntegrationTestCase', ')', ':', '___EOS___']", "index": 96 } ]
[ { "span": "from gevent.event import Event", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 30 }, { "span": "from mock import Mock, patch, ANY", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 33 }, { "span": "from interface.objects import ProcessStateEnum", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 46 } ]
[]
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", "author\\u\\u_", "=_", "'", "Dav", "e", " ", "Fos", "ter", " ", "<", "df", "ost", "er", "@", "asa", "scie", "nce", ".", "com", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyo", "n_", "._", "util_", "._", "int\\u", "test_", "import_", "Io", "n", "Integrati", "on", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyo", "n_", "._", "util_", "._", "unit", "\\u", "test_", "import_", "Py", "on", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "plugins_", "._", "attrib_", "import_", "attr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyo", "n_", "._", "container_", "._", "cc_", "import_", "Container_", ",_", "CCA", "P_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gevent_", "._", "event_", "import_", "Event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mock_", "import_", "Mock_", ",_", "patch_", ",_", "ANY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "interface_", "._", "services_", "._", "icon", "tain", "er", "\\u", "agent_", "import_", "Containe", "r", "Agent", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "interface_", "._", "objects_", "import_", "Process", "State", "Enum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "@_", "attr_", "(_", "'", "UNIT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Test", "CC_", "(_", "Py", "on", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "CC_", "(_", "Py", "on", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cc_", "=_", "Container_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "CC_", "(_", "Py", "on", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "patch_", "(_", "'", "pyo", "n", ".", "container", ".", "cc", ".", "log", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "patch_", "(_", "'", "pyo", "n", ".", "container", ".", "cc", ".", "os", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "fail", "\\u", "fast_", "(_", "self_", ",_", "osm", "ock_", ",_", "logm", "ock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cc_", "._", "stop_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cc_", "._", "fail", "\\u", "fast_", "(_", "'", "dip", "pin", " ", "dot", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "it", " ", "call", "ed", " ", "the", " ", "thing", "s", " ", "we", " ", "expect_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "dip", "pin", " ", "dot", "s", "'_", ",_", "str_", "(_", "logm", "ock_", "._", "error_", "._", "call", "\\u", "args", "\\u", "list_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cc_", "._", "stop_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "osm", "ock_", "._", "kill_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "osm", "ock_", "._", "getpid_", "(_", ")_", ",_", "signal_", "._", "SIGTERM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "CC_", "(_", "Py", "on", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "patch_", "(_", "'", "pyo", "n", ".", "container", ".", "cc", ".", "os", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "fail", "\\u", "fast", "\\u", "no", "\\u", "stop_", "(_", "self_", ",_", "osm", "ock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cc_", "._", "stop_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cc_", "._", "fail", "\\u", "fast_", "(_", "\"", "ice", "crea", "m", " ", "(", "of", " ", "the", " ", "future", ")\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "cc_", "._", "stop_", "._", "call", "\\u", "count_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "CC_", "(_", "Py", "on", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "node", "\\u", "whe", "n", "\\u", "not", "\\u", "started_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "cc_", "._", "node_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "CC_", "(_", "Py", "on", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "node", "\\u", "whe", "n", "\\u", "started_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cc_", "._", "\\u", "capabilities_", "._", "append_", "(_", "\"", "EXCH", "ANGE", "\\u", "MANAGER", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cc_", "._", "ex", "\\u", "manager_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "cc_", "._", "node_", ",_", "self_", "._", "cc_", "._", "ex", "\\u", "manager_", "._", "default", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "attr_", "(_", "'", "INT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Test", "CC", "Int_", "(_", "Io", "n", "Integrati", "on", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "CC", "Int_", "(_", "Io", "n", "Integrati", "on", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "start", "\\u", "hello_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "start", " ", "a", " ", "service", " ", "over", " ", "messaging_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "start", "\\u", "container_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc", "\\u", "client_", "=_", "Containe", "r", "Agent", "Client_", "(_", "node_", "=_", "self_", "._", "container_", "._", "node_", ",_", "name_", "=_", "self_", "._", "container_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "cc", "\\u", "client_", "._", "spawn", "\\u", "process_", "(_", "'", "hell", "o", "'_", ",_", "'", "example", "s", ".", "service", ".", "hell", "o", "\\u", "service", "'_", ",_", "'", "Hell", "o", "Service", "'_", ")_", "\\u\\u\\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_", "@_", "attr_", "(_", "'", "INT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Test", "CC", "Int", "Proc", "s_", "(_", "Io", "n", "Integrati", "on", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Expect", "ed", "Failure_", "(_", "Standard", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "CC", "Int", "Proc", "s_", "(_", "Io", "n", "Integrati", "on", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "want", " ", "to", " ", "connect", " ", "to", " ", "AMQ", "P", " ", "or", " ", "do", " ", "a", " ", "pid", "file", " ", "or", " ", "any", " ", "of", " ", "tha", "t", " ", "ja", "zz", " ", "-", " ", "just", " ", "the", " ", "proc", " ", "manage", "r", " ", "plea", "se_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cc_", "=_", "Container_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cc_", "._", "resource", "\\u", "registry_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cc_", "._", "resource", "\\u", "registry_", "._", "create_", "._", "return", "\\u", "value_", "=_", "[_", "\"", "ID", "\"_", ",_", "\"", "rev", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cc_", "._", "event", "\\u", "pub_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cc_", "._", "proc", "\\u", "manager_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cc_", "._", "stop_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cc_", "._", "stop_", "._", "side", "\\u", "effect_", "=_", "self_", "._", "cc_", "._", "proc", "\\u", "manager_", "._", "stop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "CC", "Int", "Proc", "s_", "(_", "Io", "n", "Integrati", "on", "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]_", "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_", "@_", "attr_", "(_", "'", "INT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Test", "Containe", "r", "Capabilities", "_", "(_", "Io", "n", "Integrati", "on", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Containe", "r", "Capabilities", "_", "(_", "Io", "n", "Integrati", "on", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "develop", "ment_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "pyo", "n_", "._", "container_", "._", "cc_", "import_", "CFG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "profile_", "=_", "CFG_", "._", "container_", "._", "profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CFG_", "._", "container_", "._", "profile_", "=_", "\"", "develop", "ment", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "start", "\\u", "container_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "CCA", "P_", "._", "RES", "OUR", "CE", "\\u", "REGISTRY", "_", ",_", "self_", "._", "container_", "._", "\\u", "capabilities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "container_", "._", "\\u", "cap", "\\u", "instances_", "[_", "CCA", "P_", "._", "RES", "OUR", "CE", "\\u", "REGISTRY", "_", "]_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "\"", "Reso", "urc", "e", "Regi", "stry", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "CCA", "P_", "._", "EVENT", "\\u", "REPOS", "ITOR", "Y_", ",_", "self_", "._", "container_", "._", "\\u", "capabilities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "CCA", "P_", "._", "GO", "VER", "NAN", "CE", "\\u", "CONTROLLER", "_", ",_", "self_", "._", "container_", "._", "\\u", "capabilities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Greater_", "(_", "len_", "(_", "self_", "._", "container_", "._", "\\u", "capabilities_", ")_", ",_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "CFG_", "._", "get", "\\u", "safe_", "(_", "\"", "container", ".", "mess", "agin", "g", ".", "server", ".", "primary", "\"_", ")_", ",_", "\"", "amqp", "\"_", ")_", "\\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 ", " _", "CFG_", "._", "container_", "._", "profile_", "=_", "old", "\\u", "profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Containe", "r", "Capabilities", "_", "(_", "Io", "n", "Integrati", "on", "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", "gum", "sti", "x_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "pyo", "n_", "._", "container_", "._", "cc_", "import_", "CFG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "profile_", "=_", "CFG_", "._", "container_", "._", "profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CFG_", "._", "container_", "._", "profile_", "=_", "\"", "gum", "sti", "x", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "start", "\\u", "container_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "CCA", "P_", "._", "RES", "OUR", "CE", "\\u", "REGISTRY", "_", ",_", "self_", "._", "container_", "._", "\\u", "capabilities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "container_", "._", "\\u", "cap", "\\u", "instances_", "[_", "CCA", "P_", "._", "RES", "OUR", "CE", "\\u", "REGISTRY", "_", "]_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "\"", "Emb", "edd", "ed", "Reso", "urc", "e", "Regi", "stry", "Capa", "bilit", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "CCA", "P_", "._", "EVENT", "\\u", "REPOS", "ITOR", "Y_", ",_", "self_", "._", "container_", "._", "\\u", "capabilities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "CCA", "P_", "._", "GO", "VER", "NAN", "CE", "\\u", "CONTROLLER", "_", ",_", "self_", "._", "container_", "._", "\\u", "capabilities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Less_", "(_", "len_", "(_", "self_", "._", "container_", "._", "\\u", "capabilities_", ")_", ",_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "checks", " ", "the", " ", "config", " ", "override_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "TOD", "O", " ", "cann", "ot", " ", "check", " ", "this", " ", "here", " ", "bec", "aus", "e", " ", "container", " ", "was", " ", "not", " ", "start", "ed", " ", "with", " ", "pyc", "c", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Equal", "(", "CF", "G", ".", "get", "\\u", "safe", "(\"", "container", ".", "mess", "agin", "g", ".", "server", ".", "primary", "\")", ",", " ", "\"", "local", "router", "\")", "_", "\\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 ", " _", "CFG_", "._", "container_", "._", "profile_", "=_", "old", "\\u", "profile_" ]
[ 4, 4, 4, 4, 4, 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 ]
`__eq__` not overridden when adding attributes
apache/libcloud/libcloud/compute/drivers/azure.py
[ { "content": "class _ListOf(list):\n\n \"\"\"\n A list which carries with it the type that's expected to go in it.\n Used for deserializaion and construction of the lists\n \"\"\"\n", "metadata": "root._ListOf", "header": "['module', '___EOS___']", "index": 3520 }, { "content": " def __init__(self, list_type, xml_element_name=None):\n self.list_type = list_type\n if xml_element_name is None:\n self.xml_element_name = list_type.__name__\n else:\n self.xml_element_name = xml_element_name\n super(_ListOf, self).__init__()", "metadata": "root._ListOf.__init__", "header": "['class', '_ListOf', '(', 'list', ')', ':', '___EOS___']", "index": 3527 }, { "content": "class ScalarListOf(list):\n\n \"\"\"\n A list of scalar types which carries with it the type that's\n expected to go in it along with its xml element name.\n Used for deserializaion and construction of the lists\n \"\"\"\n", "metadata": "root.ScalarListOf", "header": "['module', '___EOS___']", "index": 3536 }, { "content": " def __init__(self, list_type, xml_element_name):\n self.list_type = list_type\n self.xml_element_name = xml_element_name\n super(ScalarListOf, self).__init__()", "metadata": "root.ScalarListOf.__init__", "header": "['class', 'ScalarListOf', '(', 'list', ')', ':', '___EOS___']", "index": 3544 }, { "content": "class _DictOf(dict):\n\n \"\"\"\n A dict which carries with it the xml element names for key,val.\n Used for deserializaion and construction of the lists\n \"\"\"\n", "metadata": "root._DictOf", "header": "['module', '___EOS___']", "index": 3550 }, { "content": " def __init__(self,\n pair_xml_element_name,\n key_xml_element_name,\n value_xml_element_name):\n self.pair_xml_element_name = pair_xml_element_name\n self.key_xml_element_name = key_xml_element_name\n self.value_xml_element_name = value_xml_element_name\n super(_DictOf, self).__init__()", "metadata": "root._DictOf.__init__", "header": "['class', '_DictOf', '(', 'dict', ')', ':', '___EOS___']", "index": 3557 } ]
[ { "span": "class _ListOf(list):", "start_line": 3520, "start_column": 0, "end_line": 3520, "end_column": 20 }, { "span": "class ScalarListOf(list):", "start_line": 3536, "start_column": 0, "end_line": 3536, "end_column": 25 }, { "span": "class _DictOf(dict):", "start_line": 3550, "start_column": 0, "end_line": 3550, "end_column": 20 } ]
[ { "span": "self.list_type ", "start_line": 3528, "start_column": 8, "end_line": 3528, "end_column": 22 }, { "span": "self.xml_element_name ", "start_line": 3530, "start_column": 12, "end_line": 3530, "end_column": 33 }, { "span": "self.xml_element_name ", "start_line": 3532, "start_column": 12, "end_line": 3532, "end_column": 33 }, { "span": "self.list_type ", "start_line": 3545, "start_column": 8, "end_line": 3545, "end_column": 22 }, { "span": "self.xml_element_name ", "start_line": 3546, "start_column": 8, "end_line": 3546, "end_column": 29 }, { "span": "self.pair_xml_element_name ", "start_line": 3561, "start_column": 8, "end_line": 3561, "end_column": 34 }, { "span": "self.key_xml_element_name ", "start_line": 3562, "start_column": 8, "end_line": 3562, "end_column": 33 }, { "span": "self.value_xml_element_name ", "start_line": 3563, "start_column": 8, "end_line": 3563, "end_column": 35 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "eq\\u\\u_", "`_", "not_", "overrid", "den_", "when_", "addin", "g_", "attributes_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "List", "Of_", "(_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "list", " ", "whi", "ch", " ", "carri", "es", " ", "with", " ", "it", " ", "the", " ", "type", " ", "tha", "t", "'", "s", " ", "expected", " ", "to", " ", "go", " ", "in", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "for", " ", "deser", "iali", "za", "ion", " ", "and", " ", "constructi", "on", " ", "of", " ", "the", " ", "lists", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "List", "Of_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "list", "\\u", "type_", ",_", "xml", "\\u", "element", "\\u", "name_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "list", "\\u", "type_", "=_", "list", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xml", "\\u", "element", "\\u", "name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "xml", "\\u", "element", "\\u", "name_", "=_", "list", "\\u", "type_", "._", "\\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 ", " _", "self_", "._", "xml", "\\u", "element", "\\u", "name_", "=_", "xml", "\\u", "element", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "\\u", "List", "Of_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Scala", "r", "List", "Of_", "(_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "list", " ", "of", " ", "scala", "r", " ", "types", " ", "whi", "ch", " ", "carri", "es", " ", "with", " ", "it", " ", "the", " ", "type", " ", "tha", "t", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "expected", " ", "to", " ", "go", " ", "in", " ", "it", " ", "along", " ", "with", " ", "its", " ", "xml", " ", "element", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "for", " ", "deser", "iali", "za", "ion", " ", "and", " ", "constructi", "on", " ", "of", " ", "the", " ", "lists", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Scala", "r", "List", "Of_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "list", "\\u", "type_", ",_", "xml", "\\u", "element", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "list", "\\u", "type_", "=_", "list", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "xml", "\\u", "element", "\\u", "name_", "=_", "xml", "\\u", "element", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Scala", "r", "List", "Of_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Dict", "Of_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "dict", " ", "whi", "ch", " ", "carri", "es", " ", "with", " ", "it", " ", "the", " ", "xml", " ", "element", " ", "names", " ", "for", " ", "key", ",", "val", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "for", " ", "deser", "iali", "za", "ion", " ", "and", " ", "constructi", "on", " ", "of", " ", "the", " ", "lists", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Dict", "Of_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pair", "\\u", "xml", "\\u", "element", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key", "\\u", "xml", "\\u", "element", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value", "\\u", "xml", "\\u", "element", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pair", "\\u", "xml", "\\u", "element", "\\u", "name_", "=_", "pair", "\\u", "xml", "\\u", "element", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "key", "\\u", "xml", "\\u", "element", "\\u", "name_", "=_", "key", "\\u", "xml", "\\u", "element", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value", "\\u", "xml", "\\u", "element", "\\u", "name_", "=_", "value", "\\u", "xml", "\\u", "element", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "\\u", "Dict", "Of_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 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 ]
Unused import
aldryn/aldryn-newsblog/aldryn_newsblog/south_migrations/0027_rename_plugins_to_include_appname.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom south.utils import datetime_utils as datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\nfrom aldryn_newsblog.utils.migration import rename_tables_old_to_new, rename_tables_new_to_old\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n models = {\n u'aldryn_categories.category': {\n 'Meta': {'object_name': 'Category'},\n 'depth': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'rgt': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})\n },\n u'aldryn_newsblog.article': {\n 'Meta': {'ordering': \"[u'-publishing_date']\", 'object_name': 'Article'},\n 'app_config': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['aldryn_newsblog.NewsBlogConfig']\"}),\n 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['aldryn_people.Person']\", 'null': 'True', 'blank': 'True'}),\n 'categories': ('aldryn_categories.fields.CategoryManyToManyField', [], {'to': u\"orm['aldryn_categories.Category']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'content': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"u'aldryn_newsblog_articles'\", 'unique': 'True', 'null': 'True', 'to': \"orm['cms.Placeholder']\"}),\n 'featured_image': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['filer.Image']\", 'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_featured': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),\n 'is_published': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}),\n 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['auth.User']\"}),\n 'publishing_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'related': ('sortedm2m.fields.SortedManyToManyField', [], {'related_name': \"'related_rel_+'\", 'blank': 'True', 'to': u\"orm['aldryn_newsblog.Article']\"})\n },\n u'aldryn_newsblog.articletranslation': {\n 'Meta': {'unique_together': \"[(u'language_code', u'slug'), (u'language_code', u'master')]\", 'object_name': 'ArticleTranslation', 'db_table': \"u'aldryn_newsblog_article_translation'\"},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'language_code': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),\n 'lead_in': ('djangocms_text_ckeditor.fields.HTMLField', [], {'default': \"u''\", 'blank': 'True'}),\n u'master': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'translations'\", 'null': 'True', 'to': u\"orm['aldryn_newsblog.Article']\"}),\n 'meta_description': ('django.db.models.fields.TextField', [], {'default': \"u''\", 'blank': 'True'}),\n 'meta_keywords': ('django.db.models.fields.TextField', [], {'default': \"u''\", 'blank': 'True'}),\n 'meta_title': ('django.db.models.fields.CharField', [], {'default': \"u''\", 'max_length': '255', 'blank': 'True'}),\n 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'blank': 'True'}),\n 'title': ('django.db.models.fields.CharField', [], {'max_length': '234'})\n },\n u'aldryn_newsblog.newsblogarchiveplugin': {\n 'Meta': {'object_name': 'NewsBlogArchivePlugin'},\n 'app_config': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['aldryn_newsblog.NewsBlogConfig']\"}),\n 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'related_name': \"u'+'\", 'unique': 'True', 'primary_key': 'True', 'to': \"orm['cms.CMSPlugin']\"})\n },\n u'aldryn_newsblog.newsblogauthorsplugin': {\n 'Meta': {'object_name': 'NewsBlogAuthorsPlugin'},\n 'app_config': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['aldryn_newsblog.NewsBlogConfig']\"}),\n 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'related_name': \"u'+'\", 'unique': 'True', 'primary_key': 'True', 'to': \"orm['cms.CMSPlugin']\"})\n },\n u'aldryn_newsblog.newsblogcategoriesplugin': {\n 'Meta': {'object_name': 'NewsBlogCategoriesPlugin'},\n 'app_config': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['aldryn_newsblog.NewsBlogConfig']\"}),\n 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'related_name': \"u'+'\", 'unique': 'True', 'primary_key': 'True', 'to': \"orm['cms.CMSPlugin']\"})\n },\n u'aldryn_newsblog.newsblogconfig': {\n 'Meta': {'object_name': 'NewsBlogConfig'},\n 'app_data': ('app_data.fields.AppDataField', [], {'default': \"'{}'\"}),\n 'create_authors': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'detail_view_placeholder': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"u'aldryn_newsblog_detail_view_placeholder_set'\", 'null': 'True', 'to': \"orm['cms.Placeholder']\"}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'list_view_placeholder': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"u'aldryn_newsblog_list_view_placeholder_set'\", 'null': 'True', 'to': \"orm['cms.Placeholder']\"}),\n 'namespace': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '100'}),\n 'paginate_by': ('django.db.models.fields.PositiveIntegerField', [], {'default': '5'}),\n 'search_indexed': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'type': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n },\n u'aldryn_newsblog.newsblogconfigtranslation': {\n 'Meta': {'unique_together': \"[(u'language_code', u'master')]\", 'object_name': 'NewsBlogConfigTranslation', 'db_table': \"u'aldryn_newsblog_newsblogconfig_translation'\"},\n 'app_title': ('django.db.models.fields.CharField', [], {'max_length': '234'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'language_code': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),\n u'master': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'translations'\", 'null': 'True', 'to': u\"orm['aldryn_newsblog.NewsBlogConfig']\"})\n },\n u'aldryn_newsblog.newsblogfeaturedarticlesplugin': {\n 'Meta': {'object_name': 'NewsBlogFeaturedArticlesPlugin'},\n 'app_config': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['aldryn_newsblog.NewsBlogConfig']\"}),\n 'article_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),\n 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'related_name': \"u'+'\", 'unique': 'True', 'primary_key': 'True', 'to': \"orm['cms.CMSPlugin']\"})\n },\n u'aldryn_newsblog.newsbloglatestarticlesplugin': {\n 'Meta': {'object_name': 'NewsBlogLatestArticlesPlugin'},\n 'app_config': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['aldryn_newsblog.NewsBlogConfig']\"}),\n 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'related_name': \"u'+'\", 'unique': 'True', 'primary_key': 'True', 'to': \"orm['cms.CMSPlugin']\"}),\n 'latest_articles': ('django.db.models.fields.IntegerField', [], {'default': '5'})\n },\n u'aldryn_newsblog.newsblogrelatedplugin': {\n 'Meta': {'object_name': 'NewsBlogRelatedPlugin', '_ormbases': ['cms.CMSPlugin']},\n 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'related_name': \"u'+'\", 'unique': 'True', 'primary_key': 'True', 'to': \"orm['cms.CMSPlugin']\"})\n },\n u'aldryn_newsblog.newsblogtagsplugin': {\n 'Meta': {'object_name': 'NewsBlogTagsPlugin'},\n 'app_config': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['aldryn_newsblog.NewsBlogConfig']\"}),\n 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'related_name': \"u'+'\", 'unique': 'True', 'primary_key': 'True', 'to': \"orm['cms.CMSPlugin']\"})\n },\n u'aldryn_people.group': {\n 'Meta': {'object_name': 'Group'},\n 'address': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n 'city': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),\n 'email': ('django.db.models.fields.EmailField', [], {'default': \"u''\", 'max_length': '75', 'blank': 'True'}),\n 'fax': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'phone': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),\n 'website': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'})\n },\n u'aldryn_people.person': {\n 'Meta': {'object_name': 'Person'},\n 'email': ('django.db.models.fields.EmailField', [], {'default': \"u''\", 'max_length': '75', 'blank': 'True'}),\n 'fax': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'group': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['aldryn_people.Group']\", 'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'mobile': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'phone': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'slug': ('django.db.models.fields.CharField', [], {'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}),\n 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['auth.User']\", 'unique': 'True', 'null': 'True', 'blank': 'True'}),\n 'vcard_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'visual': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': \"orm['filer.Image']\", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),\n 'website': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'})\n },\n u'auth.group': {\n 'Meta': {'object_name': 'Group'},\n u'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': u\"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'})\n },\n u'auth.permission': {\n 'Meta': {'ordering': \"(u'content_type__app_label', u'content_type__model', u'codename')\", 'unique_together': \"((u'content_type', u'codename'),)\", 'object_name': 'Permission'},\n 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['contenttypes.ContentType']\"}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})\n },\n u'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', [], {'symmetrical': 'False', 'related_name': \"u'user_set'\", 'blank': 'True', 'to': u\"orm['auth.Group']\"}),\n u'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', [], {'symmetrical': 'False', 'related_name': \"u'user_set'\", 'blank': 'True', 'to': u\"orm['auth.Permission']\"}),\n 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})\n },\n 'cms.cmsplugin': {\n 'Meta': {'object_name': 'CMSPlugin'},\n 'changed_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'language': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),\n 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['cms.CMSPlugin']\", 'null': 'True', 'blank': 'True'}),\n 'placeholder': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['cms.Placeholder']\", 'null': 'True'}),\n 'plugin_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),\n 'position': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})\n },\n 'cms.placeholder': {\n 'Meta': {'object_name': 'Placeholder'},\n 'default_width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'slot': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'})\n },\n u'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 u'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 u'filer.file': {\n 'Meta': {'object_name': 'File'},\n '_file_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'file': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'folder': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"u'all_files'\", 'null': 'True', 'to': u\"orm['filer.Folder']\"}),\n 'has_all_mandatory_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'default': \"u''\", 'max_length': '255', 'blank': 'True'}),\n 'original_filename': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"u'owned_files'\", 'null': 'True', 'to': u\"orm['auth.User']\"}),\n 'polymorphic_ctype': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"u'polymorphic_filer.file_set'\", 'null': 'True', 'to': u\"orm['contenttypes.ContentType']\"}),\n 'sha1': ('django.db.models.fields.CharField', [], {'default': \"u''\", 'max_length': '40', 'blank': 'True'}),\n 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'})\n },\n u'filer.folder': {\n 'Meta': {'ordering': \"(u'name',)\", 'unique_together': \"((u'parent', u'name'),)\", 'object_name': 'Folder'},\n 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n u'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n u'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"u'filer_owned_folders'\", 'null': 'True', 'to': u\"orm['auth.User']\"}),\n 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"u'children'\", 'null': 'True', 'to': u\"orm['filer.Folder']\"}),\n u'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n u'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'})\n },\n 'filer.image': {\n 'Meta': {'object_name': 'Image'},\n '_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n '_width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'author': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'date_taken': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n 'default_alt_text': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'default_caption': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n u'file_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u\"orm['filer.File']\", 'unique': 'True', 'primary_key': 'True'}),\n 'must_always_publish_author_credit': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'must_always_publish_copyright': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'subject_location': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '64', 'null': 'True', 'blank': 'True'})\n }\n }\n\n complete_apps = ['aldryn_newsblog']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def forwards(self, orm):\n rename_tables_old_to_new(db)\n # Renaming model 'TagsPlugin'\n db.rename_table(u'aldryn_newsblog_tagsplugin', u'aldryn_newsblog_newsblogtagsplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='tagsplugin').update(model='newsblogtagsplugin')\n\n # Renaming model 'AuthorsPlugin'\n db.rename_table(u'aldryn_newsblog_authorsplugin', u'aldryn_newsblog_newsblogauthorsplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='authorsplugin').update(model='newsblogauthorsplugin')\n\n # Renaming model 'CategoriesPlugin'\n db.rename_table(u'aldryn_newsblog_categoriesplugin', u'aldryn_newsblog_newsblogcategoriesplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='categoriesplugin').update(model='newsblogcategoriesplugin')\n\n # Renaming model 'FeaturedArticlesPlugin'\n db.rename_table(u'aldryn_newsblog_featuredarticlesplugin', u'aldryn_newsblog_newsblogfeaturedarticlesplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='featuredarticlesplugin').update(model='newsblogfeaturedarticlesplugin')\n\n # Renaming model 'LatestEntriesPlugin'\n db.rename_table(u'aldryn_newsblog_latestentriesplugin', u'aldryn_newsblog_newsbloglatestarticlesplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='latestentriesplugin').update(model='newsbloglatestarticlesplugin')\n # Also, rename latest_entries -> latest_articles\n db.rename_column('aldryn_newsblog_newsbloglatestarticlesplugin', 'latest_entries', 'latest_articles')\n\n # Renaming model 'RelatedPlugin'\n db.rename_table(u'aldryn_newsblog_relatedplugin', u'aldryn_newsblog_newsblogrelatedplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='relatedplugin').update(model='newsblogrelatedplugin')\n\n # Renaming model 'ArchivePlugin'\n db.rename_table(u'aldryn_newsblog_archiveplugin', u'aldryn_newsblog_newsblogarchiveplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='archiveplugin').update(model='newsblogarchiveplugin')", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 11 }, { "content": " def backwards(self, orm):\n rename_tables_new_to_old(db)\n\n # Renaming model 'TagsPlugin'\n db.rename_table(u'aldryn_newsblog_newsblogtagsplugin', u'aldryn_newsblog_tagsplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='newsblogtagsplugin').update(model='tagsplugin')\n\n # Renaming model 'AuthorsPlugin'\n db.rename_table(u'aldryn_newsblog_newsblogauthorsplugin', u'aldryn_newsblog_authorsplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='newsblogauthorsplugin').update(model='authorsplugin')\n\n # Renaming model 'CategoriesPlugin'\n db.rename_table(u'aldryn_newsblog_newsblogcategoriesplugin', u'aldryn_newsblog_categoriesplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='newsblogcategoriesplugin').update(model='categoriesplugin')\n\n # Renaming model 'FeaturedArticlesPlugin'\n db.rename_table(u'aldryn_newsblog_newsblogfeaturedarticlesplugin', u'aldryn_newsblog_featuredarticlesplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='newsblogfeaturedarticlesplugin').update(model='featuredarticlesplugin')\n\n # Rename latest_articles -> latest_entries\n db.rename_column('aldryn_newsblog_newsbloglatestarticlesplugin', 'latest_articles', 'latest_entries')\n # Renaming model 'LatestEntriesPlugin'\n db.rename_table(u'aldryn_newsblog_newsbloglatestarticlesplugin', u'aldryn_newsblog_latestentriesplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='newsbloglatestarticlesplugin').update(model='latestentriesplugin')\n\n # Renaming model 'RelatedPlugin'\n db.rename_table(u'aldryn_newsblog_newsblogrelatedplugin', u'aldryn_newsblog_relatedplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='newsblogrelatedplugin').update(model='relatedplugin')\n\n # Renaming model 'ArchivePlugin'\n db.rename_table(u'aldryn_newsblog_newsblogarchiveplugin', u'aldryn_newsblog_archiveplugin')\n if not db.dry_run:\n orm['contenttypes.contenttype'].objects.filter(\n app_label='aldryn_newsblog', model='newsblogarchiveplugin').update(model='archiveplugin')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 57 } ]
[ { "span": "from south.utils import datetime_utils as datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 50 }, { "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_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ald", "ry", "n", "\\u", "news", "blog_", "._", "utils_", "._", "migration_", "import_", "rename", "\\u", "tables", "\\u", "old", "\\u", "to", "\\u", "new_", ",_", "rename", "\\u", "tables", "\\u", "new", "\\u", "to", "\\u", "old_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "ald", "ry", "n", "\\u", "categor", "ies", ".", "category", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Cate", "gory", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "depth", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lft", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rg", "t", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tree", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", ".", "article", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "u", "'-", "publishing", "\\u", "date", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Artic", "le", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "config", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "ald", "ry", "n", "\\u", "news", "blog", ".", "News", "Blog", "Config", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "author", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "ald", "ry", "n", "\\u", "people", ".", "Person", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "categor", "ies", "'_", ":_", "(_", "'", "ald", "ry", "n", "\\u", "categor", "ies", ".", "fields", ".", "Cate", "gory", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "ald", "ry", "n", "\\u", "categor", "ies", ".", "Cate", "gory", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "article", "s", "'\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "cms", ".", "Place", "holder", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "feature", "d\\u", "image", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "filer", ".", "Image", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "feature", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "publi", "shed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publishing", "\\u", "date", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "relate", "d", "'_", ":_", "(_", "'", "sorte", "dm", "2m", ".", "fields", ".", "Sorte", "d", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "relate", "d\\u", "rel", "\\u", "+'\"", "_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "ald", "ry", "n", "\\u", "news", "blog", ".", "Artic", "le", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", ".", "article", "translatio", "n", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"[", "(", "u", "'", "language", "\\u", "code", "',", " ", "u", "'", "slug", "')", ",", " ", "(", "u", "'", "language", "\\u", "code", "',", " ", "u", "'", "master", "')]\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Artic", "le", "Translat", "ion", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "article", "\\u", "translatio", "n", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "15", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lead", "\\u", "in", "'_", ":_", "(_", "'", "django", "cms", "\\u", "text", "\\u", "cked", "itor", ".", "fields", ".", "HTM", "LF", "iel", "d", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"", "u", "''", "\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "master", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "translatio", "ns", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "ald", "ry", "n", "\\u", "news", "blog", ".", "Artic", "le", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "meta", "\\u", "description", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"", "u", "''", "\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "meta", "\\u", "keywords", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"", "u", "''", "\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "meta", "\\u", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"", "u", "''", "\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "234", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", ".", "news", "blog", "archive", "plugin", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "News", "Blog", "Archive", "Plug", "in", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "config", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "ald", "ry", "n", "\\u", "news", "blog", ".", "News", "Blog", "Config", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cms", "plugin", "\\u", "ptr", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'+", "'\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "cms", ".", "CMS", "Plug", "in", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", ".", "news", "blog", "author", "splu", "gin", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "News", "Blog", "Author", "s", "Plug", "in", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "config", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "ald", "ry", "n", "\\u", "news", "blog", ".", "News", "Blog", "Config", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cms", "plugin", "\\u", "ptr", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'+", "'\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "cms", ".", "CMS", "Plug", "in", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", ".", "news", "blog", "categor", "ies", "plugin", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "News", "Blog", "Categori", "es", "Plug", "in", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "config", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "ald", "ry", "n", "\\u", "news", "blog", ".", "News", "Blog", "Config", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cms", "plugin", "\\u", "ptr", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'+", "'\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "cms", ".", "CMS", "Plug", "in", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", ".", "news", "blog", "config", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "News", "Blog", "Config", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "data", "'_", ":_", "(_", "'", "app", "\\u", "data", ".", "fields", ".", "App", "Data", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'{", "}'\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "create", "\\u", "author", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deta", "il", "\\u", "view", "\\u", "placehold", "er", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "deta", "il", "\\u", "view", "\\u", "placehold", "er", "\\u", "set", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "cms", ".", "Place", "holder", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "list", "\\u", "view", "\\u", "placehold", "er", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "list", "\\u", "view", "\\u", "placehold", "er", "\\u", "set", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "cms", ".", "Place", "holder", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "namespace", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Non", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "paginate", "\\u", "by", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "5", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "search", "\\u", "indexe", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", ".", "news", "blog", "config", "translatio", "n", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"[", "(", "u", "'", "language", "\\u", "code", "',", " ", "u", "'", "master", "')]\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "News", "Blog", "Config", "Translat", "ion", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "config", "\\u", "translatio", "n", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "234", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "15", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "master", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "translatio", "ns", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "ald", "ry", "n", "\\u", "news", "blog", ".", "News", "Blog", "Config", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", ".", "news", "blog", "feature", "dart", "icl", "esp", "lugi", "n", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "News", "Blog", "Feature", "d", "Artic", "les", "Plug", "in", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "config", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "ald", "ry", "n", "\\u", "news", "blog", ".", "News", "Blog", "Config", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "article", "\\u", "count", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "1", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cms", "plugin", "\\u", "ptr", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'+", "'\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "cms", ".", "CMS", "Plug", "in", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", ".", "news", "blog", "late", "start", "icl", "esp", "lugi", "n", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "News", "Blog", "Late", "st", "Artic", "les", "Plug", "in", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "config", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "ald", "ry", "n", "\\u", "news", "blog", ".", "News", "Blog", "Config", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cms", "plugin", "\\u", "ptr", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'+", "'\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "cms", ".", "CMS", "Plug", "in", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "late", "st", "\\u", "article", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "5", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", ".", "news", "blog", "relate", "dp", "lugi", "n", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "News", "Blog", "Rela", "ted", "Plug", "in", "'_", ",_", "'\\u", "ormbase", "s", "'_", ":_", "[_", "'", "cms", ".", "CMS", "Plug", "in", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cms", "plugin", "\\u", "ptr", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'+", "'\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "cms", ".", "CMS", "Plug", "in", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", ".", "news", "blog", "tags", "plugin", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "News", "Blog", "Ta", "gs", "Plug", "in", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "config", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "ald", "ry", "n", "\\u", "news", "blog", ".", "News", "Blog", "Config", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cms", "plugin", "\\u", "ptr", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'+", "'\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "cms", ".", "CMS", "Plug", "in", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "ald", "ry", "n", "\\u", "people", ".", "group", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Group", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "city", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"", "u", "''", "\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fax", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phone", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "postal", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "20", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "webs", "ite", "'_", ":_", "(_", "'", "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_", "u", "'", "ald", "ry", "n", "\\u", "people", ".", "person", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Person", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"", "u", "''", "\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fax", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "ald", "ry", "n", "\\u", "people", ".", "Group", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mobile", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "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", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phone", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vcard", "\\u", "enable", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "visu", "al", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Non", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "filer", ".", "Image", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "on", "\\u", "delete", "'_", ":_", "'", "model", "s", ".", "SET", "\\u", "NULL", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "webs", "ite", "'_", ":_", "(_", "'", "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_", "u", "'", "auth", ".", "group", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Group", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "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", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "auth", ".", "permissi", "on", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "u", "'", "content", "\\u", "type\\u\\u", "app", "\\u", "label", "',", " ", "u", "'", "content", "\\u", "type\\u\\u", "model", "',", " ", "u", "'", "code", "name", "')\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "(", "u", "'", "content", "\\u", "type", "',", " ", "u", "'", "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", "'_", ":_", "u", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\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", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "user", "\\u", "set", "'\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "Group", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "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", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "user", "\\u", "set", "'\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", "}_", ")_", ",_", "\\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_", "'", "cms", ".", "cms", "plugin", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "CMS", "Plug", "in", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "d\\u", "date", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "creati", "on", "\\u", "date", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "15", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lft", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "cms", ".", "CMS", "Plug", "in", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "placehold", "er", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "cms", ".", "Place", "holder", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plugin", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "position", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rg", "ht", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tree", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cms", ".", "placehold", "er", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Place", "holder", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "\\u", "widt", "h", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slot", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\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_", "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_", "u", "'", "filer", ".", "file", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "File", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "file", "\\u", "size", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "files", ".", "File", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "folder", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "all", "\\u", "files", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "filer", ".", "Fold", "er", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "all", "\\u", "mandat", "ory", "\\u", "data", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "public", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "modifi", "ed", "\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"", "u", "''", "\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "original", "\\u", "filename", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "owned", "\\u", "files", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "polymorphic", "\\u", "ctype", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "polymorphic", "\\u", "filer", ".", "file", "\\u", "set", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sha1", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"", "u", "''", "\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "40", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uploade", "d\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "filer", ".", "folder", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "u", "'", "name", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "(", "u", "'", "parent", "',", " ", "u", "'", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Fold", "er", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "level", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "lft", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "modifi", "ed", "\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "filer", "\\u", "owned", "\\u", "folder", "s", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "child", "ren", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "filer", ".", "Fold", "er", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "rg", "ht", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "tree", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uploade", "d\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filer", ".", "image", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Image", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "height", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "widt", "h", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "author", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "take", "n", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "\\u", "alt", "\\u", "text", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "\\u", "caption", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "file", "\\u", "ptr", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "filer", ".", "File", "']\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "must", "\\u", "alw", "ay", "s", "\\u", "publi", "sh", "\\u", "author", "\\u", "credit", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "must", "\\u", "alw", "ay", "s", "\\u", "publi", "sh", "\\u", "copyr", "ight", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subject", "\\u", "location", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Non", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rename", "\\u", "tables", "\\u", "old", "\\u", "to", "\\u", "new_", "(_", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Ta", "gs", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "tags", "plugin", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "tags", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "tags", "plugin", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "news", "blog", "tags", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Author", "s", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "author", "splu", "gin", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "author", "splu", "gin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "author", "splu", "gin", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "news", "blog", "author", "splu", "gin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Categori", "es", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "categor", "ies", "plugin", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "categor", "ies", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "categor", "ies", "plugin", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "news", "blog", "categor", "ies", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Feature", "d", "Artic", "les", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "feature", "dart", "icl", "esp", "lugi", "n", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "feature", "dart", "icl", "esp", "lugi", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "feature", "dart", "icl", "esp", "lugi", "n", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "news", "blog", "feature", "dart", "icl", "esp", "lugi", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Late", "st", "Entr", "ies", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "late", "sten", "trie", "splu", "gin", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "late", "start", "icl", "esp", "lugi", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "late", "sten", "trie", "splu", "gin", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "news", "blog", "late", "start", "icl", "esp", "lugi", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Al", "so", ",", " ", "rename", " ", "late", "st", "\\u", "entri", "es", " ", "->", " ", "late", "st", "\\u", "articles_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "column_", "(_", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "late", "start", "icl", "esp", "lugi", "n", "'_", ",_", "'", "late", "st", "\\u", "entri", "es", "'_", ",_", "'", "late", "st", "\\u", "article", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Rela", "ted", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "relate", "dp", "lugi", "n", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "relate", "dp", "lugi", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "relate", "dp", "lugi", "n", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "news", "blog", "relate", "dp", "lugi", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Archive", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "archive", "plugin", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "archive", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "archive", "plugin", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "news", "blog", "archive", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rename", "\\u", "tables", "\\u", "new", "\\u", "to", "\\u", "old_", "(_", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Ta", "gs", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "tags", "plugin", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "tags", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "news", "blog", "tags", "plugin", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "tags", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Author", "s", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "author", "splu", "gin", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "author", "splu", "gin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "news", "blog", "author", "splu", "gin", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "author", "splu", "gin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Categori", "es", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "categor", "ies", "plugin", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "categor", "ies", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "news", "blog", "categor", "ies", "plugin", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "categor", "ies", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Feature", "d", "Artic", "les", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "feature", "dart", "icl", "esp", "lugi", "n", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "feature", "dart", "icl", "esp", "lugi", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "news", "blog", "feature", "dart", "icl", "esp", "lugi", "n", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "feature", "dart", "icl", "esp", "lugi", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rename", " ", "late", "st", "\\u", "article", "s", " ", "->", " ", "late", "st", "\\u", "entries_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "column_", "(_", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "late", "start", "icl", "esp", "lugi", "n", "'_", ",_", "'", "late", "st", "\\u", "article", "s", "'_", ",_", "'", "late", "st", "\\u", "entri", "es", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Late", "st", "Entr", "ies", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "late", "start", "icl", "esp", "lugi", "n", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "late", "sten", "trie", "splu", "gin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "news", "blog", "late", "start", "icl", "esp", "lugi", "n", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "late", "sten", "trie", "splu", "gin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Rela", "ted", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "relate", "dp", "lugi", "n", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "relate", "dp", "lugi", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "news", "blog", "relate", "dp", "lugi", "n", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "relate", "dp", "lugi", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ren", "amin", "g", " ", "model", " ", "'", "Archive", "Plug", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "rename", "\\u", "table_", "(_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "news", "blog", "archive", "plugin", "'_", ",_", "u", "'", "ald", "ry", "n", "\\u", "news", "blog", "\\u", "archive", "plugin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orm_", "[_", "'", "contenttype", "s", ".", "contenttype", "'_", "]_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "ald", "ry", "n", "\\u", "news", "blog", "'_", ",_", "model_", "=_", "'", "news", "blog", "archive", "plugin", "'_", ")_", "._", "update_", "(_", "model_", "=_", "'", "archive", "plugin", "'_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 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 ]
Unused local variable
nipy/nitime/nitime/tests/test_viz.py
[ { "content": "def test_drawmatrix_channels():\n fig01 = drawmatrix_channels(C.corrcoef, roi_names, size=[10., 10.], color_anchor=0)", "metadata": "root.test_drawmatrix_channels", "header": "['module', '___EOS___']", "index": 30 }, { "content": "def test_plot_xcorr():\n xc = C.xcorr_norm\n\n fig02 = plot_xcorr(xc,\n ((0, 1),\n (2, 3)),\n line_labels=['a', 'b'])", "metadata": "root.test_plot_xcorr", "header": "['module', '___EOS___']", "index": 33 }, { "content": "@npt.dec.skipif(no_networkx, no_networkx_msg)\ndef test_drawgraph_channels():\n fig04 = drawgraph_channels(C.corrcoef, roi_names)", "metadata": "root.test_drawgraph_channels", "header": "['module', '___EOS___']", "index": 42 } ]
[ { "span": "fig01 ", "start_line": 31, "start_column": 4, "end_line": 31, "end_column": 9 }, { "span": "fig02 ", "start_line": 36, "start_column": 4, "end_line": 36, "end_column": 9 }, { "span": "fig04 ", "start_line": 44, "start_column": 4, "end_line": 44, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "draw", "matrix", "\\u", "channels_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig", "01_", "=_", "draw", "matrix", "\\u", "channels_", "(_", "C_", "._", "corr", "coef_", ",_", "roi", "\\u", "names_", ",_", "size_", "=_", "[_", "10._", ",_", "10._", "]_", ",_", "color", "\\u", "anchor_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "plot", "\\u", "xco", "rr_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xc_", "=_", "C_", "._", "xco", "rr", "\\u", "norm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig", "02_", "=_", "plot", "\\u", "xco", "rr_", "(_", "xc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "(_", "0_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "3_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "line", "\\u", "labels_", "=_", "[_", "'", "a", "'_", ",_", "'", "b", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "npt_", "._", "dec_", "._", "skipif_", "(_", "no", "\\u", "networkx_", ",_", "no", "\\u", "networkx", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "draw", "graph", "\\u", "channels_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig", "04_", "=_", "draw", "graph", "\\u", "channels_", "(_", "C_", "._", "corr", "coef_", ",_", "roi", "\\u", "names_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 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, 4, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
wreckage/django-happenings/happenings/south_migrations/0001_initial.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom south.utils import datetime_utils as datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n u'auth.group': {\n 'Meta': {'object_name': 'Group'},\n u'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': u\"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'})\n },\n u'auth.permission': {\n 'Meta': {'ordering': \"(u'content_type__app_label', u'content_type__model', u'codename')\", 'unique_together': \"((u'content_type', u'codename'),)\", 'object_name': 'Permission'},\n 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['contenttypes.ContentType']\"}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})\n },\n u'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', [], {'symmetrical': 'False', 'related_name': \"u'user_set'\", 'blank': 'True', 'to': u\"orm['auth.Group']\"}),\n u'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', [], {'symmetrical': 'False', 'related_name': \"u'user_set'\", 'blank': 'True', 'to': u\"orm['auth.Permission']\"}),\n 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})\n },\n u'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 u'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 u'happenings.category': {\n 'Meta': {'object_name': 'Category'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})\n },\n u'happenings.event': {\n 'Meta': {'object_name': 'Event'},\n 'all_day': ('django.db.models.fields.BooleanField', [], {}),\n 'background_color': ('django.db.models.fields.CharField', [], {'default': \"'eeeeee'\", 'max_length': '10'}),\n 'background_color_custom': ('django.db.models.fields.CharField', [], {'max_length': '6', 'blank': 'True'}),\n 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['happenings.Category']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'events'\", 'to': u\"orm['auth.User']\"}),\n 'description': ('django.db.models.fields.TextField', [], {}),\n 'end_date': ('django.db.models.fields.DateTimeField', [], {}),\n 'end_repeat': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),\n 'font_color': ('django.db.models.fields.CharField', [], {'default': \"'000000'\", 'max_length': '10'}),\n 'font_color_custom': ('django.db.models.fields.CharField', [], {'max_length': '6', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'location': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['happenings.Location']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'repeat': ('django.db.models.fields.CharField', [], {'default': \"'NEVER'\", 'max_length': '15'}),\n 'start_date': ('django.db.models.fields.DateTimeField', [], {}),\n 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['happenings.Tag']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})\n },\n u'happenings.location': {\n 'Meta': {'object_name': 'Location'},\n 'address_line_1': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),\n 'address_line_2': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),\n 'address_line_3': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),\n 'city': ('django.db.models.fields.CharField', [], {'max_length': '63', 'blank': 'True'}),\n 'country': ('django.db.models.fields.CharField', [], {'max_length': '127', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'state': ('django.db.models.fields.CharField', [], {'max_length': '63', 'blank': 'True'}),\n 'zipcode': ('django.db.models.fields.CharField', [], {'max_length': '31', 'blank': 'True'})\n },\n u'happenings.tag': {\n 'Meta': {'object_name': 'Tag'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})\n }\n }\n\n complete_apps = ['happenings']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def forwards(self, orm):\n # Adding model 'Event'\n db.create_table(u'happenings_event', (\n (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('start_date', self.gf('django.db.models.fields.DateTimeField')()),\n ('end_date', self.gf('django.db.models.fields.DateTimeField')()),\n ('all_day', self.gf('django.db.models.fields.BooleanField')()),\n ('repeat', self.gf('django.db.models.fields.CharField')(default='NEVER', max_length=15)),\n ('end_repeat', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),\n ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),\n ('description', self.gf('django.db.models.fields.TextField')()),\n ('created_by', self.gf('django.db.models.fields.related.ForeignKey')(related_name='events', to=orm['auth.User'])),\n ('background_color', self.gf('django.db.models.fields.CharField')(default='eeeeee', max_length=10)),\n ('background_color_custom', self.gf('django.db.models.fields.CharField')(max_length=6, blank=True)),\n ('font_color', self.gf('django.db.models.fields.CharField')(default='000000', max_length=10)),\n ('font_color_custom', self.gf('django.db.models.fields.CharField')(max_length=6, blank=True)),\n ))\n db.send_create_signal(u'happenings', ['Event'])\n\n # Adding M2M table for field location on 'Event'\n m2m_table_name = db.shorten_name(u'happenings_event_location')\n db.create_table(m2m_table_name, (\n ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),\n ('event', models.ForeignKey(orm[u'happenings.event'], null=False)),\n ('location', models.ForeignKey(orm[u'happenings.location'], null=False))\n ))\n db.create_unique(m2m_table_name, ['event_id', 'location_id'])\n\n # Adding M2M table for field categories on 'Event'\n m2m_table_name = db.shorten_name(u'happenings_event_categories')\n db.create_table(m2m_table_name, (\n ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),\n ('event', models.ForeignKey(orm[u'happenings.event'], null=False)),\n ('category', models.ForeignKey(orm[u'happenings.category'], null=False))\n ))\n db.create_unique(m2m_table_name, ['event_id', 'category_id'])\n\n # Adding M2M table for field tags on 'Event'\n m2m_table_name = db.shorten_name(u'happenings_event_tags')\n db.create_table(m2m_table_name, (\n ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),\n ('event', models.ForeignKey(orm[u'happenings.event'], null=False)),\n ('tag', models.ForeignKey(orm[u'happenings.tag'], null=False))\n ))\n db.create_unique(m2m_table_name, ['event_id', 'tag_id'])\n\n # Adding model 'Location'\n db.create_table(u'happenings_location', (\n (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),\n ('address_line_1', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),\n ('address_line_2', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),\n ('address_line_3', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),\n ('state', self.gf('django.db.models.fields.CharField')(max_length=63, blank=True)),\n ('city', self.gf('django.db.models.fields.CharField')(max_length=63, blank=True)),\n ('zipcode', self.gf('django.db.models.fields.CharField')(max_length=31, blank=True)),\n ('country', self.gf('django.db.models.fields.CharField')(max_length=127, blank=True)),\n ))\n db.send_create_signal(u'happenings', ['Location'])\n\n # Adding model 'Category'\n db.create_table(u'happenings_category', (\n (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),\n ))\n db.send_create_signal(u'happenings', ['Category'])\n\n # Adding model 'Tag'\n db.create_table(u'happenings_tag', (\n (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),\n ))\n db.send_create_signal(u'happenings', ['Tag'])", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 9 }, { "content": " def backwards(self, orm):\n # Deleting model 'Event'\n db.delete_table(u'happenings_event')\n\n # Removing M2M table for field location on 'Event'\n db.delete_table(db.shorten_name(u'happenings_event_location'))\n\n # Removing M2M table for field categories on 'Event'\n db.delete_table(db.shorten_name(u'happenings_event_categories'))\n\n # Removing M2M table for field tags on 'Event'\n db.delete_table(db.shorten_name(u'happenings_event_tags'))\n\n # Deleting model 'Location'\n db.delete_table(u'happenings_location')\n\n # Deleting model 'Category'\n db.delete_table(u'happenings_category')\n\n # Deleting model 'Tag'\n db.delete_table(u'happenings_tag')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 84 } ]
[ { "span": "from south.utils import datetime_utils as datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 50 } ]
[]
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_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "auth", ".", "group", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Group", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "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", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "auth", ".", "permissi", "on", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "u", "'", "content", "\\u", "type\\u\\u", "app", "\\u", "label", "',", " ", "u", "'", "content", "\\u", "type\\u\\u", "model", "',", " ", "u", "'", "code", "name", "')\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "(", "u", "'", "content", "\\u", "type", "',", " ", "u", "'", "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", "'_", ":_", "u", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\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", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "user", "\\u", "set", "'\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "Group", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "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", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "user", "\\u", "set", "'\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", "}_", ")_", ",_", "\\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_", "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_", "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_", "u", "'", "happ", "eni", "ngs", ".", "category", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Cate", "gory", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "happ", "eni", "ngs", ".", "event", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Event", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "all", "\\u", "day", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "background", "\\u", "color", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "eeee", "ee", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "10", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "background", "\\u", "color", "\\u", "custom", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "6", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "categor", "ies", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "happ", "eni", "ngs", ".", "Cate", "gory", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "by", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "events", "'\"_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "end", "\\u", "date", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "end", "\\u", "repeat", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "font", "\\u", "color", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "000000", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "10", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "font", "\\u", "color", "\\u", "custom", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "6", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "happ", "eni", "ngs", ".", "Locat", "ion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "repeat", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "NE", "VER", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "15", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "\\u", "date", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tags", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "happ", "eni", "ngs", ".", "Ta", "g", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "happ", "eni", "ngs", ".", "location", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Locat", "ion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "\\u", "line", "\\u", "1", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "\\u", "line", "\\u", "2", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "\\u", "line", "\\u", "3", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "city", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "6", "3", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "countr", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "127", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "6", "3", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "zipcode", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "3", "1", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "happ", "eni", "ngs", ".", "tag", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Ta", "g", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", "\\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_", "=_", "[_", "'", "happ", "eni", "ngs", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Event", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "create", "\\u", "table_", "(_", "u", "'", "happ", "eni", "ngs", "\\u", "event", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "u", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "start", "\\u", "date", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "end", "\\u", "date", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "all", "\\u", "day", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ")_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "repeat", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "default_", "=_", "'", "NE", "VER", "'_", ",_", "max", "\\u", "length_", "=_", "15_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "end", "\\u", "repeat", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Field", "'_", ")_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "title", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "255_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "description", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ")_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "created", "\\u", "by", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "relate", "d\\u", "name_", "=_", "'", "events", "'_", ",_", "to_", "=_", "orm_", "[_", "'", "auth", ".", "User", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "background", "\\u", "color", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "default_", "=_", "'", "eeee", "ee", "'_", ",_", "max", "\\u", "length_", "=_", "10_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "background", "\\u", "color", "\\u", "custom", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "6_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "font", "\\u", "color", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "default_", "=_", "'", "000000", "'_", ",_", "max", "\\u", "length_", "=_", "10_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "font", "\\u", "color", "\\u", "custom", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "6_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "u", "'", "happ", "eni", "ngs", "'_", ",_", "[_", "'", "Event", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "M2", "M", " ", "table", " ", "for", " ", "field", " ", "location", " ", "on", " ", "'", "Event", "'_", "\\u\\u\\uNL\\u\\u\\u_", "m2", "m", "\\u", "table", "\\u", "name_", "=_", "db_", "._", "shorten", "\\u", "name_", "(_", "u", "'", "happ", "eni", "ngs", "\\u", "event", "\\u", "location", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "m2", "m", "\\u", "table", "\\u", "name_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "models_", "._", "Auto", "Field_", "(_", "verbo", "se", "\\u", "name_", "=_", "'", "ID", "'_", ",_", "primary", "\\u", "key_", "=_", "True_", ",_", "auto", "\\u", "created_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "event", "'_", ",_", "models_", "._", "Fore", "ign", "Key_", "(_", "orm_", "[_", "u", "'", "happ", "eni", "ngs", ".", "event", "'_", "]_", ",_", "null_", "=_", "False_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "location", "'_", ",_", "models_", "._", "Fore", "ign", "Key_", "(_", "orm_", "[_", "u", "'", "happ", "eni", "ngs", ".", "location", "'_", "]_", ",_", "null_", "=_", "False_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "create", "\\u", "unique_", "(_", "m2", "m", "\\u", "table", "\\u", "name_", ",_", "[_", "'", "event", "\\u", "id", "'_", ",_", "'", "location", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "M2", "M", " ", "table", " ", "for", " ", "field", " ", "categor", "ies", " ", "on", " ", "'", "Event", "'_", "\\u\\u\\uNL\\u\\u\\u_", "m2", "m", "\\u", "table", "\\u", "name_", "=_", "db_", "._", "shorten", "\\u", "name_", "(_", "u", "'", "happ", "eni", "ngs", "\\u", "event", "\\u", "categor", "ies", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "m2", "m", "\\u", "table", "\\u", "name_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "models_", "._", "Auto", "Field_", "(_", "verbo", "se", "\\u", "name_", "=_", "'", "ID", "'_", ",_", "primary", "\\u", "key_", "=_", "True_", ",_", "auto", "\\u", "created_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "event", "'_", ",_", "models_", "._", "Fore", "ign", "Key_", "(_", "orm_", "[_", "u", "'", "happ", "eni", "ngs", ".", "event", "'_", "]_", ",_", "null_", "=_", "False_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "category", "'_", ",_", "models_", "._", "Fore", "ign", "Key_", "(_", "orm_", "[_", "u", "'", "happ", "eni", "ngs", ".", "category", "'_", "]_", ",_", "null_", "=_", "False_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "create", "\\u", "unique_", "(_", "m2", "m", "\\u", "table", "\\u", "name_", ",_", "[_", "'", "event", "\\u", "id", "'_", ",_", "'", "category", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "M2", "M", " ", "table", " ", "for", " ", "field", " ", "tags", " ", "on", " ", "'", "Event", "'_", "\\u\\u\\uNL\\u\\u\\u_", "m2", "m", "\\u", "table", "\\u", "name_", "=_", "db_", "._", "shorten", "\\u", "name_", "(_", "u", "'", "happ", "eni", "ngs", "\\u", "event", "\\u", "tags", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "m2", "m", "\\u", "table", "\\u", "name_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "models_", "._", "Auto", "Field_", "(_", "verbo", "se", "\\u", "name_", "=_", "'", "ID", "'_", ",_", "primary", "\\u", "key_", "=_", "True_", ",_", "auto", "\\u", "created_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "event", "'_", ",_", "models_", "._", "Fore", "ign", "Key_", "(_", "orm_", "[_", "u", "'", "happ", "eni", "ngs", ".", "event", "'_", "]_", ",_", "null_", "=_", "False_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "tag", "'_", ",_", "models_", "._", "Fore", "ign", "Key_", "(_", "orm_", "[_", "u", "'", "happ", "eni", "ngs", ".", "tag", "'_", "]_", ",_", "null_", "=_", "False_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "create", "\\u", "unique_", "(_", "m2", "m", "\\u", "table", "\\u", "name_", ",_", "[_", "'", "event", "\\u", "id", "'_", ",_", "'", "tag", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Locat", "ion", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "u", "'", "happ", "eni", "ngs", "\\u", "location", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "u", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "255_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "address", "\\u", "line", "\\u", "1", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "255_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "address", "\\u", "line", "\\u", "2", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "255_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "address", "\\u", "line", "\\u", "3", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "255_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "state", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "63_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "city", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "63_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "zipcode", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "31_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "countr", "y", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "127_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "u", "'", "happ", "eni", "ngs", "'_", ",_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Cate", "gory", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "u", "'", "happ", "eni", "ngs", "\\u", "category", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "u", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "title", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "255_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "u", "'", "happ", "eni", "ngs", "'_", ",_", "[_", "'", "Cate", "gory", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Ta", "g", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "u", "'", "happ", "eni", "ngs", "\\u", "tag", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "u", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "255_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "u", "'", "happ", "eni", "ngs", "'_", ",_", "[_", "'", "Ta", "g", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Event", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "table_", "(_", "u", "'", "happ", "eni", "ngs", "\\u", "event", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remo", "ving", " ", "M2", "M", " ", "table", " ", "for", " ", "field", " ", "location", " ", "on", " ", "'", "Event", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "db_", "._", "shorten", "\\u", "name_", "(_", "u", "'", "happ", "eni", "ngs", "\\u", "event", "\\u", "location", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remo", "ving", " ", "M2", "M", " ", "table", " ", "for", " ", "field", " ", "categor", "ies", " ", "on", " ", "'", "Event", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "db_", "._", "shorten", "\\u", "name_", "(_", "u", "'", "happ", "eni", "ngs", "\\u", "event", "\\u", "categor", "ies", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remo", "ving", " ", "M2", "M", " ", "table", " ", "for", " ", "field", " ", "tags", " ", "on", " ", "'", "Event", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "db_", "._", "shorten", "\\u", "name_", "(_", "u", "'", "happ", "eni", "ngs", "\\u", "event", "\\u", "tags", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Locat", "ion", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "u", "'", "happ", "eni", "ngs", "\\u", "location", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Cate", "gory", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "u", "'", "happ", "eni", "ngs", "\\u", "category", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Ta", "g", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "u", "'", "happ", "eni", "ngs", "\\u", "tag", "'_", ")_", "\\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, 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,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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 ]
Unused local variable
byt3bl33d3r/pth-toolkit/lib/python2.7/site-packages/openchange/utils/fdunix.py
[ { "content": "def receive_socket(socket):\n \"\"\"This function receives a socket object via a UNIX socket.\n\n socket: must be a unix socket\n\n Returns a socket object or None if the operation fails.\n\n \"\"\"\n\n iov = IOVec()\n iov.iov_base = \"A\"\n iov.iov_len = 1\n\n cmsg = CMSG()\n cmsg.cmsg_hdr.cmsg_len = CMSG_LEN(sizeof(c_int))\n\n msgh = MSGHdr()\n msgh.msg_name = None\n msgh.msg_namelen = 0\n msgh.msg_iov = (iov,)\n msgh.msg_iovlen = 1\n msgh.msg_control = pointer(cmsg)\n msgh.msg_controllen = CMSG_SPACE(sizeof(c_int))\n msgh.msg_flags = 0\n\n # rc = recvmsg(socket.fileno(), pointer(msgh), 0)\n rc = recvmsg(socket.fileno(), pointer(msgh), 0)\n if rc == -1:\n errno = get_errno()\n raise OSError(errno, strerror(errno))\n\n (value,) = unpack_from(\"i\", cmsg.cmsg_data)\n\n # the 'mode' parameter should probably passed as part of the message\n (fd,) = unpack_from(\"i\", cmsg.cmsg_data)\n newfile = fromfd(fd, AF_INET, SOCK_STREAM)\n\n return newfile", "metadata": "root.receive_socket", "header": "['module', '___EOS___']", "index": 131 } ]
[ { "span": "value,", "start_line": 162, "start_column": 5, "end_line": 162, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "receive", "\\u", "socket_", "(_", "socket_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "function", " ", "receive", "s", " ", "a", " ", "socket", " ", "object", " ", "via", " ", "a", " ", "UNIX", " ", "socket", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "socket", ":", " ", "must", " ", "be", " ", "a", " ", "unix", " ", "socket", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "socket", " ", "object", " ", "or", " ", "Non", "e", " ", "if", " ", "the", " ", "operati", "on", " ", "fail", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "io", "v_", "=_", "IO", "Vec_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "io", "v_", "._", "io", "v", "\\u", "base_", "=_", "\"", "A", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "io", "v_", "._", "io", "v", "\\u", "len_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cms", "g_", "=_", "CMS", "G_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cms", "g_", "._", "cms", "g", "\\u", "hdr_", "._", "cms", "g", "\\u", "len_", "=_", "CMS", "G", "\\u", "LEN_", "(_", "sizeof_", "(_", "c\\u", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "h_", "=_", "MS", "GH", "dr_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "h_", "._", "msg", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "h_", "._", "msg", "\\u", "namel", "en_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "h_", "._", "msg", "\\u", "io", "v_", "=_", "(_", "io", "v_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "h_", "._", "msg", "\\u", "io", "vl", "en_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "h_", "._", "msg", "\\u", "control_", "=_", "pointer_", "(_", "cms", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "h_", "._", "msg", "\\u", "controlle", "n_", "=_", "CMS", "G", "\\u", "SPACE_", "(_", "sizeof_", "(_", "c\\u", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "h_", "._", "msg", "\\u", "flags_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rc", " ", "=", " ", "recv", "msg", "(", "socket", ".", "filen", "o", "()", ",", " ", "point", "er", "(", "msg", "h", "),", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "rc_", "=_", "recv", "msg_", "(_", "socket_", "._", "fileno_", "(_", ")_", ",_", "pointer_", "(_", "msg", "h_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rc_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errno_", "=_", "get", "\\u", "errno_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "OSE", "rror_", "(_", "errno_", ",_", "strerror_", "(_", "errno_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "value_", ",_", ")_", "=_", "unpack", "\\u", "from_", "(_", "\"", "i", "\"_", ",_", "cms", "g_", "._", "cms", "g", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "'", "mode", "'", " ", "parameter", " ", "shou", "ld", " ", "probab", "ly", " ", "pass", "ed", " ", "as", " ", "part", " ", "of", " ", "the", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "fd_", ",_", ")_", "=_", "unpack", "\\u", "from_", "(_", "\"", "i", "\"_", ",_", "cms", "g_", "._", "cms", "g", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newfile", "_", "=_", "from", "fd_", "(_", "fd_", ",_", "AF", "\\u", "INET_", ",_", "SOCK", "\\u", "STREAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "newfile", "_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
open-cloud/xos/xos/tosca/tests/nodetest.py
[ { "content": "from basetest import BaseToscaTest\n\nfrom core.models import Node, Site, Deployment, SiteDeployment\n\n\nif __name__ == \"__main__\":\n NodeTest()\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class NodeTest(BaseToscaTest):\n tests = [\"create_node_minimal\",\n \"create_node_nocreate\",\n \"destroy_node\",\n \"destroy_node_nodelete\",\n ]\n\n\n\n\n\n", "metadata": "root.NodeTest", "header": "['module', '___EOS___']", "index": 4 }, { "content": " def cleanup(self):\n self.try_to_delete(Node, name=\"testnode\")\n self.try_to_delete(Site, name=\"testsite\")\n self.try_to_delete(Deployment, name=\"testdep\")", "metadata": "root.NodeTest.cleanup", "header": "['class', 'NodeTest', '(', 'BaseToscaTest', ')', ':', '___EOS___']", "index": 11 }, { "content": " def get_base_templates(self):\n return \\\n\"\"\"\n testdep:\n type: tosca.nodes.Deployment\n testcon:\n type: tosca.nodes.Controller\n requirements:\n - deployment:\n node: testdep\n relationship: tosca.relationships.ControllerDeployment\n testsite:\n type: tosca.nodes.Site\n properties:\n display_name: My Site\n requirements:\n - deployment:\n node: testdep\n relationship: tosca.relationships.SiteDeployment\n requirements:\n - controller:\n node: testcon\n relationship: tosca.relationships.UsesController\n\"\"\"", "metadata": "root.NodeTest.get_base_templates", "header": "['class', 'NodeTest', '(', 'BaseToscaTest', ')', ':', '___EOS___']", "index": 16 }, { "content": " def create_node_minimal(self):\n self.assert_noobj(Node, \"testnode\")\n self.execute(self.get_base_templates() +\n self.make_nodetemplate(\"testnode\", \"tosca.nodes.Node\",\n reqs=[(\"testsite\", \"tosca.relationships.MemberOfSite\"),\n (\"testdep\", \"tosca.relationships.MemberOfDeployment\")]))\n node = self.assert_obj(Node, \"testnode\")\n assert(node.site_deployment is not None)\n assert(node.site is not None)", "metadata": "root.NodeTest.create_node_minimal", "header": "['class', 'NodeTest', '(', 'BaseToscaTest', ')', ':', '___EOS___']", "index": 41 }, { "content": " def create_node_nocreate(self):\n self.assert_noobj(Node, \"testnode\")\n self.execute(self.get_base_templates() +\n self.make_nodetemplate(\"testnode\", \"tosca.nodes.Node\",\n reqs=[(\"testsite\", \"tosca.relationships.MemberOfSite\"),\n (\"testdep\", \"tosca.relationships.MemberOfDeployment\")],\n props={\"no-create\": True}))\n self.assert_noobj(Node, \"testnode\")", "metadata": "root.NodeTest.create_node_nocreate", "header": "['class', 'NodeTest', '(', 'BaseToscaTest', ')', ':', '___EOS___']", "index": 51 }, { "content": " def destroy_node(self):\n self.assert_noobj(Node, \"testnode\")\n self.execute(self.get_base_templates() +\n self.make_nodetemplate(\"testnode\", \"tosca.nodes.Node\",\n reqs=[(\"testsite\", \"tosca.relationships.MemberOfSite\"),\n (\"testdep\", \"tosca.relationships.MemberOfDeployment\")]))\n self.assert_obj(Node, \"testnode\")\n self.destroy(self.get_base_templates() +\n self.make_nodetemplate(\"testnode\", \"tosca.nodes.Node\",\n reqs=[(\"testsite\", \"tosca.relationships.MemberOfSite\"),\n (\"testdep\", \"tosca.relationships.MemberOfDeployment\")]))\n self.assert_noobj(Node, \"testnode\")", "metadata": "root.NodeTest.destroy_node", "header": "['class', 'NodeTest', '(', 'BaseToscaTest', ')', ':', '___EOS___']", "index": 60 }, { "content": " def destroy_node_nodelete(self):\n self.assert_noobj(Node, \"testnode\")\n self.execute(self.get_base_templates() +\n self.make_nodetemplate(\"testnode\", \"tosca.nodes.Node\",\n reqs=[(\"testsite\", \"tosca.relationships.MemberOfSite\"),\n (\"testdep\", \"tosca.relationships.MemberOfDeployment\")]))\n self.assert_obj(Node, \"testnode\")\n self.destroy(self.get_base_templates() +\n self.make_nodetemplate(\"testnode\", \"tosca.nodes.Node\",\n reqs=[(\"testsite\", \"tosca.relationships.MemberOfSite\"),\n (\"testdep\", \"tosca.relationships.MemberOfDeployment\")],\n props={\"no-delete\": True}))\n self.assert_obj(Node, \"testnode\")", "metadata": "root.NodeTest.destroy_node_nodelete", "header": "['class', 'NodeTest', '(', 'BaseToscaTest', ')', ':', '___EOS___']", "index": 73 } ]
[ { "span": "from core.models import Node, Site, Deployment, SiteDeployment", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 62 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "base", "test_", "import_", "Base", "Tos", "ca", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "core_", "._", "models_", "import_", "Node_", ",_", "Site_", ",_", "Deployment", "_", ",_", "Site", "Deployment", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Node", "Test_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Node", "Test_", "(_", "Base", "Tos", "ca", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tests_", "=_", "[_", "\"", "create", "\\u", "node", "\\u", "minima", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "create", "\\u", "node", "\\u", "noc", "reate", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "destroy", "\\u", "node", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "destroy", "\\u", "node", "\\u", "nodel", "ete", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Node", "Test_", "(_", "Base", "Tos", "ca", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "cleanup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "try", "\\u", "to", "\\u", "delete_", "(_", "Node_", ",_", "name_", "=_", "\"", "testn", "ode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "try", "\\u", "to", "\\u", "delete_", "(_", "Site_", ",_", "name_", "=_", "\"", "tests", "ite", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "try", "\\u", "to", "\\u", "delete_", "(_", "Deployment", "_", ",_", "name_", "=_", "\"", "testd", "ep", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node", "Test_", "(_", "Base", "Tos", "ca", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "base", "\\u", "templates_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "testd", "ep", ":", "\\", "10", ";", " ", " ", "type", ":", " ", "tosc", "a", ".", "nodes", ".", "Deployment", "\\", "10", ";", " ", " ", " ", " ", "testco", "n", ":", "\\", "10", ";", " ", " ", "type", ":", " ", "tosc", "a", ".", "nodes", ".", "Controlle", "r", "\\", "10", ";", " ", " ", "require", "ment", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "deploy", "ment", ":", "\\", "10", ";", " ", " ", " ", " ", "node", ":", " ", "testd", "ep", "\\", "10", ";", " ", " ", " ", " ", "relation", "ship", ":", " ", "tosc", "a", ".", "relation", "ships", ".", "Controlle", "r", "Deployment", "\\", "10", ";", " ", " ", " ", " ", "tests", "ite", ":", "\\", "10", ";", " ", " ", "type", ":", " ", "tosc", "a", ".", "nodes", ".", "Site", "\\", "10", ";", " ", " ", "proper", "ties", ":", "\\", "10", ";", " ", " ", " ", " ", "display", "\\u", "name", ":", " ", "My", " ", "Site", "\\", "10", ";", " ", " ", "require", "ment", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "deploy", "ment", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "node", ":", " ", "testd", "ep", "\\", "10", ";", " ", " ", " ", " ", " ", "relation", "ship", ":", " ", "tosc", "a", ".", "relation", "ships", ".", "Site", "Deployment", "\\", "10", ";", " ", " ", " ", " ", " ", "require", "ment", "s", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "controlle", "r", ":", "\\", "10", ";", " ", " ", " ", "node", ":", " ", "testco", "n", "\\", "10", ";", " ", " ", " ", "relation", "ship", ":", " ", "tosc", "a", ".", "relation", "ships", ".", "Us", "es", "Controlle", "r", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node", "Test_", "(_", "Base", "Tos", "ca", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "node", "\\u", "minima", "l_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "\\u", "noo", "bj_", "(_", "Node_", ",_", "\"", "testn", "ode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "execute_", "(_", "self_", "._", "get", "\\u", "base", "\\u", "templates_", "(_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "make", "\\u", "nodet", "empla", "te_", "(_", "\"", "testn", "ode", "\"_", ",_", "\"", "tosc", "a", ".", "nodes", ".", "Node", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reqs_", "=_", "[_", "(_", "\"", "tests", "ite", "\"_", ",_", "\"", "tosc", "a", ".", "relation", "ships", ".", "Mem", "ber", "Of", "Site", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "testd", "ep", "\"_", ",_", "\"", "tosc", "a", ".", "relation", "ships", ".", "Mem", "ber", "Of", "Deployment", "\"_", ")_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "self_", "._", "assert", "\\u", "obj_", "(_", "Node_", ",_", "\"", "testn", "ode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "node_", "._", "site", "\\u", "deployment_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "node_", "._", "site_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node", "Test_", "(_", "Base", "Tos", "ca", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "node", "\\u", "noc", "reate", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "\\u", "noo", "bj_", "(_", "Node_", ",_", "\"", "testn", "ode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "execute_", "(_", "self_", "._", "get", "\\u", "base", "\\u", "templates_", "(_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "make", "\\u", "nodet", "empla", "te_", "(_", "\"", "testn", "ode", "\"_", ",_", "\"", "tosc", "a", ".", "nodes", ".", "Node", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reqs_", "=_", "[_", "(_", "\"", "tests", "ite", "\"_", ",_", "\"", "tosc", "a", ".", "relation", "ships", ".", "Mem", "ber", "Of", "Site", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "testd", "ep", "\"_", ",_", "\"", "tosc", "a", ".", "relation", "ships", ".", "Mem", "ber", "Of", "Deployment", "\"_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "props_", "=_", "{_", "\"", "no", "-", "create", "\"_", ":_", "True_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "\\u", "noo", "bj_", "(_", "Node_", ",_", "\"", "testn", "ode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node", "Test_", "(_", "Base", "Tos", "ca", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "destroy", "\\u", "node_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "\\u", "noo", "bj_", "(_", "Node_", ",_", "\"", "testn", "ode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "execute_", "(_", "self_", "._", "get", "\\u", "base", "\\u", "templates_", "(_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "make", "\\u", "nodet", "empla", "te_", "(_", "\"", "testn", "ode", "\"_", ",_", "\"", "tosc", "a", ".", "nodes", ".", "Node", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reqs_", "=_", "[_", "(_", "\"", "tests", "ite", "\"_", ",_", "\"", "tosc", "a", ".", "relation", "ships", ".", "Mem", "ber", "Of", "Site", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "testd", "ep", "\"_", ",_", "\"", "tosc", "a", ".", "relation", "ships", ".", "Mem", "ber", "Of", "Deployment", "\"_", ")_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "\\u", "obj_", "(_", "Node_", ",_", "\"", "testn", "ode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "destroy_", "(_", "self_", "._", "get", "\\u", "base", "\\u", "templates_", "(_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "make", "\\u", "nodet", "empla", "te_", "(_", "\"", "testn", "ode", "\"_", ",_", "\"", "tosc", "a", ".", "nodes", ".", "Node", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reqs_", "=_", "[_", "(_", "\"", "tests", "ite", "\"_", ",_", "\"", "tosc", "a", ".", "relation", "ships", ".", "Mem", "ber", "Of", "Site", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "testd", "ep", "\"_", ",_", "\"", "tosc", "a", ".", "relation", "ships", ".", "Mem", "ber", "Of", "Deployment", "\"_", ")_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "\\u", "noo", "bj_", "(_", "Node_", ",_", "\"", "testn", "ode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node", "Test_", "(_", "Base", "Tos", "ca", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "destroy", "\\u", "node", "\\u", "nodel", "ete", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "\\u", "noo", "bj_", "(_", "Node_", ",_", "\"", "testn", "ode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "execute_", "(_", "self_", "._", "get", "\\u", "base", "\\u", "templates_", "(_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "make", "\\u", "nodet", "empla", "te_", "(_", "\"", "testn", "ode", "\"_", ",_", "\"", "tosc", "a", ".", "nodes", ".", "Node", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reqs_", "=_", "[_", "(_", "\"", "tests", "ite", "\"_", ",_", "\"", "tosc", "a", ".", "relation", "ships", ".", "Mem", "ber", "Of", "Site", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "testd", "ep", "\"_", ",_", "\"", "tosc", "a", ".", "relation", "ships", ".", "Mem", "ber", "Of", "Deployment", "\"_", ")_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "\\u", "obj_", "(_", "Node_", ",_", "\"", "testn", "ode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "destroy_", "(_", "self_", "._", "get", "\\u", "base", "\\u", "templates_", "(_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "make", "\\u", "nodet", "empla", "te_", "(_", "\"", "testn", "ode", "\"_", ",_", "\"", "tosc", "a", ".", "nodes", ".", "Node", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reqs_", "=_", "[_", "(_", "\"", "tests", "ite", "\"_", ",_", "\"", "tosc", "a", ".", "relation", "ships", ".", "Mem", "ber", "Of", "Site", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "testd", "ep", "\"_", ",_", "\"", "tosc", "a", ".", "relation", "ships", ".", "Mem", "ber", "Of", "Deployment", "\"_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "props_", "=_", "{_", "\"", "no", "-", "delete", "\"_", ":_", "True_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "\\u", "obj_", "(_", "Node_", ",_", "\"", "testn", "ode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
hgascon/pulsar/pulsar/core/sippy/Udp_server.py
[ { "content": " def run(self):\n while True:\n self.userv.wi_available.acquire()\n while len(self.userv.wi) == 0:\n self.userv.wi_available.wait()\n wi = self.userv.wi.pop(0)\n if wi == None:\n # Shutdown request, relay it further\n self.userv.wi.append(None)\n self.userv.wi_available.notify()\n self.userv.wi_available.release()\n if wi == None:\n break\n data, address = wi\n try:\n ai = socket.getaddrinfo(address[0], None, self.userv.family)\n except:\n continue\n if self.userv.family == socket.AF_INET:\n address = (ai[0][4][0], address[1])\n else:\n address = (ai[0][4][0], address[1], ai[0][4][2], ai[0][4][3])\n for i in range(0, 20):\n try:\n if self.userv.skt.sendto(data, address) == len(data):\n break\n except socket.error, why:\n if why[0] not in (EWOULDBLOCK, ENOBUFS, EAGAIN):\n break\n sleep(0.01)\n self.userv = None", "metadata": "root.AsyncSender.run", "header": "['class', 'AsyncSender', '(', 'Thread', ')', ':', '___EOS___']", "index": 43 }, { "content": " def __init__(self, address, data_callback, family = None):\n self.laddress = address\n if family == None:\n if address != None and address[0].startswith('['):\n family = socket.AF_INET6\n address = (address[0][1:-1], address[1])\n else:\n family = socket.AF_INET\n self.family = family\n self.skt = socket.socket(family, socket.SOCK_DGRAM)\n if address != None:\n ai = socket.getaddrinfo(address[0], None, family)\n if family == socket.AF_INET:\n address = (ai[0][4][0], address[1])\n else:\n address = (ai[0][4][0], address[1], ai[0][4][2], ai[0][4][3])\n self.skt.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n if hasattr(socket, 'SO_REUSEPORT'):\n self.skt.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)\n self.skt.bind(address)\n self.data_callback = data_callback\n self.sendqueue = []\n self.stats = [0, 0, 0]\n self.wi_available = Condition()\n self.wi = []\n for i in range(0, MAX_WORKERS):\n AsyncSender(self)\n AsyncReceiver(self)", "metadata": "root.Udp_server.__init__", "header": "['class', 'Udp_server', '(', 'object', ')', ':', '___EOS___']", "index": 118 } ]
[ { "span": "wi == None:", "start_line": 49, "start_column": 15, "end_line": 49, "end_column": 25 }, { "span": "wi == None:", "start_line": 54, "start_column": 15, "end_line": 54, "end_column": 25 }, { "span": "family == None:", "start_line": 120, "start_column": 11, "end_line": 120, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Async", "Sender_", "(_", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user", "v_", "._", "wi", "\\u", "available_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "self_", "._", "user", "v_", "._", "wi", "_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user", "v_", "._", "wi", "\\u", "available_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wi", "_", "=_", "self_", "._", "user", "v_", "._", "wi", "_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wi", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Shut", "down", " ", "request", ",", " ", "relay", " ", "it", " ", "fur", "ther_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user", "v_", "._", "wi", "_", "._", "append_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user", "v_", "._", "wi", "\\u", "available_", "._", "notify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "user", "v_", "._", "wi", "\\u", "available_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wi", "_", "==_", "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_", "data_", ",_", "address_", "=_", "wi", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ai_", "=_", "socket_", "._", "getadd", "rin", "fo_", "(_", "address_", "[_", "0_", "]_", ",_", "None_", ",_", "self_", "._", "user", "v_", "._", "family_", ")_", "\\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_", "self_", "._", "user", "v_", "._", "family_", "==_", "socket_", "._", "AF", "\\u", "INET_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "address_", "=_", "(_", "ai_", "[_", "0_", "]_", "[_", "4_", "]_", "[_", "0_", "]_", ",_", "address_", "[_", "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 ", " _", "address_", "=_", "(_", "ai_", "[_", "0_", "]_", "[_", "4_", "]_", "[_", "0_", "]_", ",_", "address_", "[_", "1_", "]_", ",_", "ai_", "[_", "0_", "]_", "[_", "4_", "]_", "[_", "2_", "]_", ",_", "ai_", "[_", "0_", "]_", "[_", "4_", "]_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "20_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "user", "v_", "._", "sk", "t_", "._", "sendto_", "(_", "data_", ",_", "address_", ")_", "==_", "len_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ",_", "why_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "why_", "[_", "0_", "]_", "not_", "in_", "(_", "EW", "OU", "LDB", "LOCK_", ",_", "ENO", "BUF", "S_", ",_", "EA", "GAIN", "_", ")_", ":_", "\\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_", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "user", "v_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Udp", "\\u", "server_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "address_", ",_", "data\\u", "callback_", ",_", "family_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lad", "dress", "_", "=_", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "family_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "address_", "!=_", "None_", "and_", "address_", "[_", "0_", "]_", "._", "startswith_", "(_", "'['_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "family_", "=_", "socket_", "._", "AF", "\\u", "INE", "T6", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "address_", "=_", "(_", "address_", "[_", "0_", "]_", "[_", "1_", ":_", "-_", "1_", "]_", ",_", "address_", "[_", "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 ", " _", "family_", "=_", "socket_", "._", "AF", "\\u", "INET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "family_", "=_", "family_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sk", "t_", "=_", "socket_", "._", "socket_", "(_", "family_", ",_", "socket_", "._", "SOCK", "\\u", "DGRAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "address_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ai_", "=_", "socket_", "._", "getadd", "rin", "fo_", "(_", "address_", "[_", "0_", "]_", ",_", "None_", ",_", "family_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "family_", "==_", "socket_", "._", "AF", "\\u", "INET_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "address_", "=_", "(_", "ai_", "[_", "0_", "]_", "[_", "4_", "]_", "[_", "0_", "]_", ",_", "address_", "[_", "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 ", " _", "address_", "=_", "(_", "ai_", "[_", "0_", "]_", "[_", "4_", "]_", "[_", "0_", "]_", ",_", "address_", "[_", "1_", "]_", ",_", "ai_", "[_", "0_", "]_", "[_", "4_", "]_", "[_", "2_", "]_", ",_", "ai_", "[_", "0_", "]_", "[_", "4_", "]_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sk", "t_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "socket_", "._", "SO", "\\u", "REUSE", "ADDR_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "socket_", ",_", "'", "SO", "\\u", "REUSE", "PORT", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sk", "t_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "socket_", "._", "SO", "\\u", "REUSE", "PORT_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sk", "t_", "._", "bind_", "(_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "data\\u", "callback_", "=_", "data\\u", "callback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "queue_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stats_", "=_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wi", "\\u", "available_", "=_", "Condition_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wi", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "MAX", "\\u", "WORKER", "S_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Async", "Sender_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Async", "Receiver_", "(_", "self_", ")_", "\\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, 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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 ]
Unused import
dronekit/dronekit-python/dronekit/__init__.py
[ { "content": "# DroneAPI module\n\"\"\"\nThis is the API Reference for the DroneKit-Python API.\n\nThe main API is the :py:class:`Vehicle` class.\nThe code snippet below shows how to use :py:func:`connect` to obtain an instance of a connected vehicle:\n\n.. code:: python\n\n from dronekit import connect\n\n # Connect to the Vehicle using \"connection string\" (in this case an address on network)\n vehicle = connect('127.0.0.1:14550', wait_ready=True)\n\n:py:class:`Vehicle` provides access to vehicle *state* through python attributes\n(e.g. :py:attr:`Vehicle.mode`)\nand to settings/parameters though the :py:attr:`Vehicle.parameters` attribute.\nAsynchronous notification on vehicle attribute changes is available by registering listeners/observers.\n\nVehicle movement is primarily controlled using the :py:attr:`Vehicle.armed` attribute and\n:py:func:`Vehicle.simple_takeoff` and :py:attr:`Vehicle.simple_goto` in GUIDED mode.\n\nVelocity-based movement and control over other vehicle features can be achieved using custom MAVLink messages\n(:py:func:`Vehicle.send_mavlink`, :py:func:`Vehicle.message_factory`).\n\nIt is also possible to work with vehicle \"missions\" using the :py:attr:`Vehicle.commands` attribute, and run them in AUTO mode.\n\nA number of other useful classes and methods are listed below.\n\n----\n\"\"\"\n\nfrom __future__ import print_function\nimport monotonic\nimport time\nimport socket\nimport sys\nimport os\nimport platform\nimport re\nfrom dronekit.util import errprinter\nfrom pymavlink import mavutil, mavwp\nfrom Queue import Queue, Empty\nfrom threading import Thread\nimport types\nimport threading\nimport math\nimport copy\nimport collections\nfrom pymavlink.dialects.v10 import ardupilotmega\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfrom dronekit.mavlink import MAVConnection\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class APIException(Exception):\n \"\"\"\n Base class for DroneKit related exceptions.\n\n :param String message: Message string describing the exception\n \"\"\"\n", "metadata": "root.APIException", "header": "['module', '___EOS___']", "index": 52 }, { "content": " def __init__(self, message):\n super(APIException, self).__init__(message)", "metadata": "root.APIException.__init__", "header": "['class', 'APIException', '(', 'Exception', ')', ':', '___EOS___']", "index": 59 }, { "content": "class Attitude(object):\n \"\"\"\n Attitude information.\n\n An object of this type is returned by :py:attr:`Vehicle.attitude`.\n\n .. _figure_attitude:\n\n .. figure:: http://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Yaw_Axis_Corrected.svg/500px-Yaw_Axis_Corrected.svg.png\n :width: 400px\n :alt: Diagram showing Pitch, Roll, Yaw\n :target: http://commons.wikimedia.org/wiki/File:Yaw_Axis_Corrected.svg\n\n Diagram showing Pitch, Roll, Yaw (`Creative Commons <http://commons.wikimedia.org/wiki/File:Yaw_Axis_Corrected.svg>`_)\n\n :param pitch: Pitch in radians\n :param yaw: Yaw in radians\n :param roll: Roll in radians\n \"\"\"\n\n", "metadata": "root.Attitude", "header": "['module', '___EOS___']", "index": 63 }, { "content": " def __init__(self, pitch, yaw, roll):\n self.pitch = pitch\n self.yaw = yaw\n self.roll = roll", "metadata": "root.Attitude.__init__", "header": "['class', 'Attitude', '(', 'object', ')', ':', '___EOS___']", "index": 83 }, { "content": " def __str__(self):\n return \"Attitude:pitch=%s,yaw=%s,roll=%s\" % (self.pitch, self.yaw, self.roll)", "metadata": "root.Attitude.__str__", "header": "['class', 'Attitude', '(', 'object', ')', ':', '___EOS___']", "index": 88 }, { "content": "class LocationGlobal(object):\n \"\"\"\n A global location object.\n\n The latitude and longitude are relative to the `WGS84 coordinate system <http://en.wikipedia.org/wiki/World_Geodetic_System>`_.\n The altitude is relative to mean sea-level (MSL).\n\n For example, a global location object with altitude 30 metres above sea level might be defined as:\n\n .. code:: python\n\n LocationGlobal(-34.364114, 149.166022, 30)\n\n .. todo:: FIXME: Location class - possibly add a vector3 representation.\n\n An object of this type is owned by :py:attr:`Vehicle.location`. See that class for information on\n reading and observing location in the global frame.\n\n :param lat: Latitude.\n :param lon: Longitude.\n :param alt: Altitude in meters relative to mean sea-level (MSL).\n \"\"\"\n\n", "metadata": "root.LocationGlobal", "header": "['module', '___EOS___']", "index": 92 }, { "content": " def __init__(self, lat, lon, alt=None):\n self.lat = lat\n self.lon = lon\n self.alt = alt\n\n # This is for backward compatibility.\n self.local_frame = None\n self.global_frame = None", "metadata": "root.LocationGlobal.__init__", "header": "['class', 'LocationGlobal', '(', 'object', ')', ':', '___EOS___']", "index": 115 }, { "content": " def __str__(self):\n return \"LocationGlobal:lat=%s,lon=%s,alt=%s\" % (self.lat, self.lon, self.alt)", "metadata": "root.LocationGlobal.__str__", "header": "['class', 'LocationGlobal', '(', 'object', ')', ':', '___EOS___']", "index": 124 }, { "content": "class LocationGlobalRelative(object):\n \"\"\"\n A global location object, with attitude relative to home location altitude.\n\n The latitude and longitude are relative to the `WGS84 coordinate system <http://en.wikipedia.org/wiki/World_Geodetic_System>`_.\n The altitude is relative to the *home position*.\n\n For example, a ``LocationGlobalRelative`` object with an altitude of 30 metres above the home location might be defined as:\n\n .. code:: python\n\n LocationGlobalRelative(-34.364114, 149.166022, 30)\n\n .. todo:: FIXME: Location class - possibly add a vector3 representation.\n\n An object of this type is owned by :py:attr:`Vehicle.location`. See that class for information on\n reading and observing location in the global-relative frame.\n\n :param lat: Latitude.\n :param lon: Longitude.\n :param alt: Altitude in meters (relative to the home location).\n \"\"\"\n\n", "metadata": "root.LocationGlobalRelative", "header": "['module', '___EOS___']", "index": 128 }, { "content": " def __init__(self, lat, lon, alt=None):\n self.lat = lat\n self.lon = lon\n self.alt = alt\n\n # This is for backward compatibility.\n self.local_frame = None\n self.global_frame = None", "metadata": "root.LocationGlobalRelative.__init__", "header": "['class', 'LocationGlobalRelative', '(', 'object', ')', ':', '___EOS___']", "index": 151 }, { "content": " def __str__(self):\n return \"LocationGlobalRelative:lat=%s,lon=%s,alt=%s\" % (self.lat, self.lon, self.alt)", "metadata": "root.LocationGlobalRelative.__str__", "header": "['class', 'LocationGlobalRelative', '(', 'object', ')', ':', '___EOS___']", "index": 160 }, { "content": "class LocationLocal(object):\n \"\"\"\n A local location object.\n\n The north, east and down are relative to the EKF origin. This is most likely the location where the vehicle was turned on.\n\n An object of this type is owned by :py:attr:`Vehicle.location`. See that class for information on\n reading and observing location in the local frame.\n\n :param north: Position north of the EKF origin in meters.\n :param east: Position east of the EKF origin in meters.\n :param down: Position down from the EKF origin in meters. (i.e. negative altitude in meters)\n \"\"\"\n\n", "metadata": "root.LocationLocal", "header": "['module', '___EOS___']", "index": 164 }, { "content": " def __init__(self, north, east, down):\n self.north = north\n self.east = east\n self.down = down", "metadata": "root.LocationLocal.__init__", "header": "['class', 'LocationLocal', '(', 'object', ')', ':', '___EOS___']", "index": 178 }, { "content": " def __str__(self):\n return \"LocationLocal:north=%s,east=%s,down=%s\" % (self.north, self.east, self.down)", "metadata": "root.LocationLocal.__str__", "header": "['class', 'LocationLocal', '(', 'object', ')', ':', '___EOS___']", "index": 183 }, { "content": "class GPSInfo(object):\n \"\"\"\n Standard information about GPS.\n\n If there is no GPS lock the parameters are set to ``None``.\n\n :param Int eph: GPS horizontal dilution of position (HDOP).\n :param Int epv: GPS vertical dilution of position (VDOP).\n :param Int fix_type: 0-1: no fix, 2: 2D fix, 3: 3D fix\n :param Int satellites_visible: Number of satellites visible.\n\n .. todo:: FIXME: GPSInfo class - possibly normalize eph/epv? report fix type as string?\n \"\"\"\n\n", "metadata": "root.GPSInfo", "header": "['module', '___EOS___']", "index": 187 }, { "content": " def __init__(self, eph, epv, fix_type, satellites_visible):\n self.eph = eph\n self.epv = epv\n self.fix_type = fix_type\n self.satellites_visible = satellites_visible", "metadata": "root.GPSInfo.__init__", "header": "['class', 'GPSInfo', '(', 'object', ')', ':', '___EOS___']", "index": 201 }, { "content": " def __str__(self):\n return \"GPSInfo:fix=%s,num_sat=%s\" % (self.fix_type, self.satellites_visible)", "metadata": "root.GPSInfo.__str__", "header": "['class', 'GPSInfo', '(', 'object', ')', ':', '___EOS___']", "index": 207 }, { "content": "class Battery(object):\n \"\"\"\n System battery information.\n\n An object of this type is returned by :py:attr:`Vehicle.battery`.\n\n :param voltage: Battery voltage in millivolts.\n :param current: Battery current, in 10 * milliamperes. ``None`` if the autopilot does not support current measurement.\n :param level: Remaining battery energy. ``None`` if the autopilot cannot estimate the remaining battery.\n \"\"\"\n\n", "metadata": "root.Battery", "header": "['module', '___EOS___']", "index": 211 }, { "content": " def __init__(self, voltage, current, level):\n self.voltage = voltage / 1000.0\n if current == -1:\n self.current = None\n else:\n self.current = current / 100.0\n if level == -1:\n self.level = None\n else:\n self.level = level", "metadata": "root.Battery.__init__", "header": "['class', 'Battery', '(', 'object', ')', ':', '___EOS___']", "index": 222 }, { "content": " def __str__(self):\n return \"Battery:voltage={},current={},level={}\".format(self.voltage, self.current,\n self.level)", "metadata": "root.Battery.__str__", "header": "['class', 'Battery', '(', 'object', ')', ':', '___EOS___']", "index": 233 }, { "content": "class Rangefinder(object):\n \"\"\"\n Rangefinder readings.\n\n An object of this type is returned by :py:attr:`Vehicle.rangefinder`.\n\n :param distance: Distance (metres). ``None`` if the vehicle doesn't have a rangefinder.\n :param voltage: Voltage (volts). ``None`` if the vehicle doesn't have a rangefinder.\n \"\"\"\n\n", "metadata": "root.Rangefinder", "header": "['module', '___EOS___']", "index": 238 }, { "content": " def __init__(self, distance, voltage):\n self.distance = distance\n self.voltage = voltage", "metadata": "root.Rangefinder.__init__", "header": "['class', 'Rangefinder', '(', 'object', ')', ':', '___EOS___']", "index": 248 }, { "content": " def __str__(self):\n return \"Rangefinder: distance={}, voltage={}\".format(self.distance, self.voltage)", "metadata": "root.Rangefinder.__str__", "header": "['class', 'Rangefinder', '(', 'object', ')', ':', '___EOS___']", "index": 252 }, { "content": "class Version(object):\n \"\"\"\n Autopilot version and type.\n\n An object of this type is returned by :py:attr:`Vehicle.version`.\n\n The version number can be read in a few different formats. To get it in a human-readable\n format, just print `vehicle.version`. This might print something like \"APM:Copter-3.3.2-rc4\".\n\n .. versionadded:: 2.0.3\n\n .. py:attribute:: major\n\n Major version number (integer).\n\n .. py:attribute::minor\n\n Minor version number (integer).\n\n .. py:attribute:: patch\n\n Patch version number (integer).\n\n .. py:attribute:: release\n\n Release type (integer). See the enum `FIRMWARE_VERSION_TYPE <http://mavlink.org/messages/common#http://mavlink.org/messages/common#FIRMWARE_VERSION_TYPE_DEV>`_.\n\n This is a composite of the product release cycle stage (rc, beta etc) and the version in that cycle - e.g. 23.\n\n \"\"\"\n\n\n\n\n\n", "metadata": "root.Version", "header": "['module', '___EOS___']", "index": 255 }, { "content": " def __init__(self, raw_version, autopilot_type, vehicle_type):\n self.autopilot_type = autopilot_type\n self.vehicle_type = vehicle_type\n self.raw_version = raw_version\n if(raw_version == None):\n self.major = None\n self.minor = None\n self.patch = None\n self.release = None\n else:\n self.major = raw_version >> 24 & 0xFF\n self.minor = raw_version >> 16 & 0xFF\n self.patch = raw_version >> 8 & 0xFF\n self.release = raw_version & 0xFF", "metadata": "root.Version.__init__", "header": "['class', 'Version', '(', 'object', ')', ':', '___EOS___']", "index": 285 }, { "content": " def is_stable(self):\n \"\"\"\n Returns True if the autopilot reports that the current firmware is a stable\n release (not a pre-release or development version).\n \"\"\"\n return self.release == 255", "metadata": "root.Version.is_stable", "header": "['class', 'Version', '(', 'object', ')', ':', '___EOS___']", "index": 300 }, { "content": " def release_version(self):\n \"\"\"\n Returns the version within the release type (an integer).\n This method returns \"23\" for Copter-3.3rc23.\n \"\"\"\n if self.release is None:\n return None\n if(self.release == 255):\n return 0\n return self.release % 64", "metadata": "root.Version.release_version", "header": "['class', 'Version', '(', 'object', ')', ':', '___EOS___']", "index": 308 }, { "content": " def release_type(self):\n \"\"\"\n Returns text describing the release type e.g. \"alpha\", \"stable\" etc.\n \"\"\"\n if self.release is None:\n return None\n types = [ \"dev\", \"alpha\", \"beta\", \"rc\" ]\n return types[self.release/64]", "metadata": "root.Version.release_type", "header": "['class', 'Version', '(', 'object', ')', ':', '___EOS___']", "index": 320 }, { "content": " def __str__(self):\n prefix=\"\"\n\n if(self.autopilot_type == mavutil.mavlink.MAV_AUTOPILOT_ARDUPILOTMEGA):\n prefix += \"APM:\"\n elif(self.autopilot_type == mavutil.mavlink.MAV_AUTOPILOT_PX4):\n prefix += \"PX4\"\n else:\n prefix += \"UnknownAutoPilot\"\n\n if(self.vehicle_type == mavutil.mavlink.MAV_TYPE_QUADROTOR):\n prefix += \"Copter-\"\n elif(self.vehicle_type == mavutil.mavlink.MAV_TYPE_FIXED_WING):\n prefix += \"Plane-\"\n elif(self.vehicle_type == mavutil.mavlink.MAV_TYPE_GROUND_ROVER):\n prefix += \"Rover-\"\n else:\n prefix += \"UnknownVehicleType%d-\" % (self.vehicle_type)\n\n if self.release_type() is None:\n release_type = \"UnknownReleaseType\"\n elif self.is_stable():\n release_type = \"\"\n else:\n # e.g. \"-rc23\"\n release_type = \"-\" + str(self.release_type()) + str(self.release_version())\n\n return prefix + \"%s.%s.%s\" % (self.major, self.minor, self.patch) + release_type", "metadata": "root.Version.__str__", "header": "['class', 'Version', '(', 'object', ')', ':', '___EOS___']", "index": 329 }, { "content": "class Capabilities:\n \"\"\"\n Autopilot capabilities (supported message types and functionality).\n\n An object of this type is returned by :py:attr:`Vehicle.capabilities`.\n\n See the enum\n `MAV_PROTOCOL_CAPABILITY <http://mavlink.org/messages/common#MAV_PROTOCOL_CAPABILITY_MISSION_FLOAT>`_.\n\n .. versionadded:: 2.0.3\n\n\n .. py:attribute:: mission_float\n\n Autopilot supports MISSION float message type (Boolean).\n\n .. py:attribute:: param_float\n\n Autopilot supports the PARAM float message type (Boolean).\n\n .. py:attribute:: mission_int\n\n Autopilot supports MISSION_INT scaled integer message type (Boolean).\n\n .. py:attribute:: command_int\n\n Autopilot supports COMMAND_INT scaled integer message type (Boolean).\n\n .. py:attribute:: param_union\n\n Autopilot supports the PARAM_UNION message type (Boolean).\n\n .. py:attribute:: ftp\n\n Autopilot supports ftp for file transfers (Boolean).\n\n .. py:attribute:: set_attitude_target\n\n Autopilot supports commanding attitude offboard (Boolean).\n\n .. py:attribute:: set_attitude_target_local_ned\n\n Autopilot supports commanding position and velocity targets in local NED frame (Boolean).\n\n .. py:attribute:: set_altitude_target_global_int\n\n Autopilot supports commanding position and velocity targets in global scaled integers (Boolean).\n\n .. py:attribute:: terrain\n\n Autopilot supports terrain protocol / data handling (Boolean).\n\n .. py:attribute:: set_actuator_target\n\n Autopilot supports direct actuator control (Boolean).\n\n .. py:attribute:: flight_termination\n\n Autopilot supports the flight termination command (Boolean).\n\n .. py:attribute:: compass_calibration\n\n Autopilot supports onboard compass calibration (Boolean).\n \"\"\"", "metadata": "root.Capabilities", "header": "['module', '___EOS___']", "index": 358 }, { "content": " def __init__(self, capabilities):\n self.mission_float = (((capabilities >> 0) & 1) == 1)\n self.param_float = (((capabilities >> 1) & 1) == 1)\n self.mission_int = (((capabilities >> 2) & 1) == 1)\n self.command_int = (((capabilities >> 3) & 1) == 1)\n self.param_union = (((capabilities >> 4) & 1) == 1)\n self.ftp = (((capabilities >> 5) & 1) == 1)\n self.set_attitude_target = (((capabilities >> 6) & 1) == 1)\n self.set_attitude_target_local_ned = (((capabilities >> 7) & 1) == 1)\n self.set_altitude_target_global_int = (((capabilities >> 8) & 1) == 1)\n self.terrain = (((capabilities >> 9) & 1) == 1)\n self.set_actuator_target = (((capabilities >> 10) & 1) == 1)\n self.flight_termination = (((capabilities >> 11) & 1) == 1)\n self.compass_calibration = (((capabilities >> 12) & 1) == 1)", "metadata": "root.Capabilities.__init__", "header": "['class', 'Capabilities', ':', '___EOS___']", "index": 422 }, { "content": "class VehicleMode(object):\n \"\"\"\n This object is used to get and set the current \"flight mode\".\n\n The flight mode determines the behaviour of the vehicle and what commands it can obey.\n The recommended flight modes for *DroneKit-Python* apps depend on the vehicle type:\n\n * Copter apps should use ``AUTO`` mode for \"normal\" waypoint missions and ``GUIDED`` mode otherwise.\n * Plane and Rover apps should use the ``AUTO`` mode in all cases, re-writing the mission commands if \"dynamic\"\n behaviour is required (they support only a limited subset of commands in ``GUIDED`` mode).\n * Some modes like ``RETURN_TO_LAUNCH`` can be used on all platforms. Care should be taken\n when using manual modes as these may require remote control input from the user.\n\n The available set of supported flight modes is vehicle-specific (see\n `Copter Modes <http://copter.ardupilot.com/wiki/flying-arducopter/flight-modes/>`_,\n `Plane Modes <http://plane.ardupilot.com/wiki/flying/flight-modes/>`_,\n `Rover Modes <http://rover.ardupilot.com/wiki/configuration-2/#mode_meanings>`_). If an unsupported mode is set the script\n will raise a ``KeyError`` exception.\n\n The :py:attr:`Vehicle.mode` attribute can be queried for the current mode.\n The code snippet below shows how to observe changes to the mode and then read the value:\n\n .. code:: python\n\n #Callback definition for mode observer\n def mode_callback(self, attr_name):\n print \"Vehicle Mode\", self.mode\n\n #Add observer callback for attribute `mode`\n vehicle.add_attribute_listener('mode', mode_callback)\n\n The code snippet below shows how to change the vehicle mode to AUTO:\n\n .. code:: python\n\n # Set the vehicle into auto mode\n vehicle.mode = VehicleMode(\"AUTO\")\n\n For more information on getting/setting/observing the :py:attr:`Vehicle.mode`\n (and other attributes) see the :ref:`attributes guide <vehicle_state_attributes>`.\n\n .. py:attribute:: name\n\n The mode name, as a ``string``.\n \"\"\"\n\n\n\n", "metadata": "root.VehicleMode", "header": "['module', '___EOS___']", "index": 438 }, { "content": " def __init__(self, name):\n self.name = name", "metadata": "root.VehicleMode.__init__", "header": "['class', 'VehicleMode', '(', 'object', ')', ':', '___EOS___']", "index": 484 }, { "content": " def __str__(self):\n return \"VehicleMode:%s\" % self.name", "metadata": "root.VehicleMode.__str__", "header": "['class', 'VehicleMode', '(', 'object', ')', ':', '___EOS___']", "index": 487 }, { "content": " def __eq__(self, other):\n return self.name == other", "metadata": "root.VehicleMode.__eq__", "header": "['class', 'VehicleMode', '(', 'object', ')', ':', '___EOS___']", "index": 490 }, { "content": " def __ne__(self, other):\n return self.name != other", "metadata": "root.VehicleMode.__ne__", "header": "['class', 'VehicleMode', '(', 'object', ')', ':', '___EOS___']", "index": 493 }, { "content": "class SystemStatus(object):\n \"\"\"\n This object is used to get and set the current \"system status\".\n\n An object of this type is returned by :py:attr:`Vehicle.system_status`.\n\n .. py:attribute:: state\n\n The system state, as a ``string``.\n \"\"\"\n\n\n\n", "metadata": "root.SystemStatus", "header": "['module', '___EOS___']", "index": 497 }, { "content": " def __init__(self, state):\n self.state = state", "metadata": "root.SystemStatus.__init__", "header": "['class', 'SystemStatus', '(', 'object', ')', ':', '___EOS___']", "index": 508 }, { "content": " def __str__(self):\n return \"SystemStatus:%s\" % self.state", "metadata": "root.SystemStatus.__str__", "header": "['class', 'SystemStatus', '(', 'object', ')', ':', '___EOS___']", "index": 511 }, { "content": " def __eq__(self, other):\n return self.state == other", "metadata": "root.SystemStatus.__eq__", "header": "['class', 'SystemStatus', '(', 'object', ')', ':', '___EOS___']", "index": 514 }, { "content": " def __ne__(self, other):\n return self.state != other", "metadata": "root.SystemStatus.__ne__", "header": "['class', 'SystemStatus', '(', 'object', ')', ':', '___EOS___']", "index": 517 }, { "content": "class HasObservers(object):\n\n\n\n\n\n", "metadata": "root.HasObservers", "header": "['module', '___EOS___']", "index": 521 }, { "content": " def __init__(self):\n # A mapping from attr_name to a list of observers\n self._attribute_listeners = {}\n self._attribute_cache = {}", "metadata": "root.HasObservers.__init__", "header": "['class', 'HasObservers', '(', 'object', ')', ':', '___EOS___']", "index": 522 }, { "content": " def add_attribute_listener(self, attr_name, observer):\n \"\"\"\n Add an attribute listener callback.\n\n The callback function (``observer``) is invoked differently depending on the *type of attribute*.\n Attributes that represent sensor values or which are used to monitor connection status are updated\n whenever a message is received from the vehicle. Attributes which reflect vehicle \"state\" are\n only updated when their values change (for example :py:attr:`Vehicle.system_status`,\n :py:attr:`Vehicle.armed`, and :py:attr:`Vehicle.mode`).\n\n The callback can be removed using :py:func:`remove_attribute_listener`.\n\n .. note::\n\n The :py:func:`on_attribute` decorator performs the same operation as this method, but with\n a more elegant syntax. Use ``add_attribute_listener`` by preference if you will need to remove\n the observer.\n\n The argument list for the callback is ``observer(object, attr_name, attribute_value)``:\n\n * ``self`` - the associated :py:class:`Vehicle`. This may be compared to a global vehicle handle\n to implement vehicle-specific callback handling (if needed).\n * ``attr_name`` - the attribute name. This can be used to infer which attribute has triggered\n if the same callback is used for watching several attributes.\n * ``value`` - the attribute value (so you don't need to re-query the vehicle object).\n\n The example below shows how to get callbacks for (global) location changes:\n\n .. code:: python\n\n #Callback to print the location in global frame\n def location_callback(self, attr_name, msg):\n print \"Location (Global): \", msg\n\n #Add observer for the vehicle's current location\n vehicle.add_attribute_listener('global_frame', location_callback)\n\n See :ref:`vehicle_state_observe_attributes` for more information.\n\n :param String attr_name: The name of the attribute to watch (or '*' to watch all attributes).\n :param observer: The callback to invoke when a change in the attribute is detected.\n\n \"\"\"\n l = self._attribute_listeners.get(attr_name)\n if l is None:\n l = []\n self._attribute_listeners[attr_name] = l\n if not observer in l:\n l.append(observer)", "metadata": "root.HasObservers.add_attribute_listener", "header": "['class', 'HasObservers', '(', 'object', ')', ':', '___EOS___']", "index": 529 }, { "content": " def remove_attribute_listener(self, attr_name, observer):\n \"\"\"\n Remove an attribute listener (observer) that was previously added using :py:func:`add_attribute_listener`.\n\n For example, the following line would remove a previously added vehicle 'global_frame'\n observer called ``location_callback``:\n\n .. code:: python\n\n vehicle.remove_attribute_listener('global_frame', location_callback)\n\n See :ref:`vehicle_state_observe_attributes` for more information.\n\n :param String attr_name: The attribute name that is to have an observer removed (or '*' to remove an 'all attribute' observer).\n :param observer: The callback function to remove.\n\n \"\"\"\n l = self._attribute_listeners.get(attr_name)\n if l is not None:\n l.remove(observer)\n if len(l) == 0:\n del self._attribute_listeners[attr_name]", "metadata": "root.HasObservers.remove_attribute_listener", "header": "['class', 'HasObservers', '(', 'object', ')', ':', '___EOS___']", "index": 579 }, { "content": " def notify_attribute_listeners(self, attr_name, value, cache=False):\n \"\"\"\n This method is used to update attribute observers when the named attribute is updated.\n\n You should call it in your message listeners after updating an attribute with\n information from a vehicle message.\n\n By default the value of ``cache`` is ``False`` and every update from the vehicle is sent to listeners\n (whether or not the attribute has changed). This is appropriate for attributes which represent sensor\n or heartbeat-type monitoring.\n\n Set ``cache=True`` to update listeners only when the value actually changes (cache the previous\n attribute value). This should be used where clients will only ever need to know the value when it has\n changed. For example, this setting has been used for notifying :py:attr:`mode` changes.\n\n See :ref:`example_create_attribute` for more information.\n\n :param String attr_name: The name of the attribute that has been updated.\n :param value: The current value of the attribute that has been updated.\n :param Boolean cache: Set ``True`` to only notify observers when the attribute value changes.\n \"\"\"\n # Cached values are not re-sent if they are unchanged.\n if cache:\n if attr_name in self._attribute_cache and self._attribute_cache[attr_name] == value:\n return\n self._attribute_cache[attr_name] = value\n\n # Notify observers.\n for fn in self._attribute_listeners.get(attr_name, []):\n try:\n fn(self, attr_name, value)\n except Exception as e:\n errprinter('>>> Exception in attribute handler for %s' %\n attr_name)\n errprinter('>>> ' + str(e))\n\n for fn in self._attribute_listeners.get('*', []):\n try:\n fn(self, attr_name, value)\n except Exception as e:\n errprinter('>>> Exception in attribute handler for %s' %\n attr_name)\n errprinter('>>> ' + str(e))", "metadata": "root.HasObservers.notify_attribute_listeners", "header": "['class', 'HasObservers', '(', 'object', ')', ':', '___EOS___']", "index": 602 }, { "content": " def on_attribute(self, name):\n \"\"\"\n Decorator for attribute listeners.\n\n The decorated function (``observer``) is invoked differently depending on the *type of attribute*.\n Attributes that represent sensor values or which are used to monitor connection status are updated\n whenever a message is received from the vehicle. Attributes which reflect vehicle \"state\" are\n only updated when their values change (for example :py:func:`Vehicle.system_status`,\n :py:attr:`Vehicle.armed`, and :py:attr:`Vehicle.mode`).\n\n The argument list for the callback is ``observer(object, attr_name, attribute_value)``\n\n * ``self`` - the associated :py:class:`Vehicle`. This may be compared to a global vehicle handle\n to implement vehicle-specific callback handling (if needed).\n * ``attr_name`` - the attribute name. This can be used to infer which attribute has triggered\n if the same callback is used for watching several attributes.\n * ``msg`` - the attribute value (so you don't need to re-query the vehicle object).\n\n .. note::\n\n There is no way to remove an attribute listener added with this decorator. Use\n :py:func:`add_attribute_listener` if you need to be able to remove\n the :py:func:`attribute listener <remove_attribute_listener>`.\n\n The code fragment below shows how you can create a listener for the attitude attribute.\n\n .. code:: python\n\n @vehicle.on_attribute('attitude')\n def attitude_listener(self, name, msg):\n print '%s attribute is: %s' % (name, msg)\n\n See :ref:`vehicle_state_observe_attributes` for more information.\n\n :param String attr_name: The name of the attribute to watch (or '*' to watch all attributes).\n :param observer: The callback to invoke when a change in the attribute is detected.\n \"\"\"\n\n def decorator(fn):\n if isinstance(name, list):\n for n in name:\n self.add_attribute_listener(n, fn)\n else:\n self.add_attribute_listener(name, fn)\n\n return decorator", "metadata": "root.HasObservers.on_attribute", "header": "['class', 'HasObservers', '(', 'object', ')', ':', '___EOS___']", "index": 646 }, { "content": "class ChannelsOverride(dict):\n \"\"\"\n A dictionary class for managing Vehicle channel overrides.\n\n Channels can be read, written, or cleared by index or using a dictionary syntax.\n To clear a value, set it to ``None`` or use ``del`` on the item.\n\n An object of this type is returned by :py:attr:`Vehicle.channels.overrides <Channels.overrides>`.\n\n For more information and examples see :ref:`example_channel_overrides`.\n \"\"\"\n\n\n\n\n\n", "metadata": "root.ChannelsOverride", "header": "['module', '___EOS___']", "index": 694 }, { "content": " def __init__(self, vehicle):\n self._vehicle = vehicle\n self._count = 8 # Fixed by MAVLink\n self._active = True", "metadata": "root.ChannelsOverride.__init__", "header": "['class', 'ChannelsOverride', '(', 'dict', ')', ':', '___EOS___']", "index": 706 }, { "content": " def __getitem__(self, key):\n return dict.__getitem__(self, str(key))", "metadata": "root.ChannelsOverride.__getitem__", "header": "['class', 'ChannelsOverride', '(', 'dict', ')', ':', '___EOS___']", "index": 711 }, { "content": " def __setitem__(self, key, value):\n if not (int(key) > 0 and int(key) <= self._count):\n raise Exception('Invalid channel index %s' % key)\n if not value:\n try:\n dict.__delitem__(self, str(key))\n except:\n pass\n else:\n dict.__setitem__(self, str(key), value)\n self._send()", "metadata": "root.ChannelsOverride.__setitem__", "header": "['class', 'ChannelsOverride', '(', 'dict', ')', ':', '___EOS___']", "index": 714 }, { "content": " def __delitem__(self, key):\n dict.__delitem__(self, str(key))\n self._send()", "metadata": "root.ChannelsOverride.__delitem__", "header": "['class', 'ChannelsOverride', '(', 'dict', ')', ':', '___EOS___']", "index": 726 }, { "content": " def __len__(self):\n return self._count", "metadata": "root.ChannelsOverride.__len__", "header": "['class', 'ChannelsOverride', '(', 'dict', ')', ':', '___EOS___']", "index": 730 }, { "content": " def _send(self):\n if self._active:\n overrides = [0] * 8\n for k, v in self.iteritems():\n overrides[int(k) - 1] = v\n self._vehicle._master.mav.rc_channels_override_send(0, 0, *overrides)", "metadata": "root.ChannelsOverride._send", "header": "['class', 'ChannelsOverride', '(', 'dict', ')', ':', '___EOS___']", "index": 733 }, { "content": "class Channels(dict):\n \"\"\"\n A dictionary class for managing RC channel information associated with a :py:class:`Vehicle`.\n\n An object of this type is accessed through :py:attr:`Vehicle.channels`. This object also stores\n the current vehicle channel overrides through its :py:attr:`overrides` attribute.\n\n For more information and examples see :ref:`example_channel_overrides`.\n \"\"\"\n\n\n\n\n\n\n\n", "metadata": "root.Channels", "header": "['module', '___EOS___']", "index": 741 }, { "content": " def __init__(self, vehicle, count):\n self._vehicle = vehicle\n self._count = count\n self._overrides = ChannelsOverride(vehicle)\n\n # populate readback\n self._readonly = False\n for k in range(0, count):\n self[k + 1] = None\n self._readonly = True", "metadata": "root.Channels.__init__", "header": "['class', 'Channels', '(', 'dict', ')', ':', '___EOS___']", "index": 751 }, { "content": " @property\n def count(self):\n \"\"\"\n The number of channels defined in the dictionary (currently 8).\n \"\"\"\n return self._count", "metadata": "root.Channels.count", "header": "['class', 'Channels', '(', 'dict', ')', ':', '___EOS___']", "index": 762 }, { "content": " def __getitem__(self, key):\n return dict.__getitem__(self, str(key))", "metadata": "root.Channels.__getitem__", "header": "['class', 'Channels', '(', 'dict', ')', ':', '___EOS___']", "index": 769 }, { "content": " def __setitem__(self, key, value):\n if self._readonly:\n raise TypeError('__setitem__ is not supported on Channels object')\n return dict.__setitem__(self, str(key), value)", "metadata": "root.Channels.__setitem__", "header": "['class', 'Channels', '(', 'dict', ')', ':', '___EOS___']", "index": 772 }, { "content": " def __len__(self):\n return self._count", "metadata": "root.Channels.__len__", "header": "['class', 'Channels', '(', 'dict', ')', ':', '___EOS___']", "index": 777 }, { "content": " def _update_channel(self, channel, value):\n # If we have channels on different ports, we expand the Channels\n # object to support them.\n channel = int(channel)\n self._readonly = False\n self[channel] = value\n self._readonly = True\n self._count = max(self._count, channel)", "metadata": "root.Channels._update_channel", "header": "['class', 'Channels', '(', 'dict', ')', ':', '___EOS___']", "index": 780 }, { "content": " @property\n def overrides(self):\n \"\"\"\n Attribute to read, set and clear channel overrides (also known as \"rc overrides\")\n associated with a :py:class:`Vehicle` (via :py:class:`Vehicle.channels`). This is an\n object of type :py:class:`ChannelsOverride`.\n\n For more information and examples see :ref:`example_channel_overrides`.\n\n To set channel overrides:\n\n .. code:: python\n\n # Set and clear overrids using dictionary syntax (clear by setting override to none)\n vehicle.channels.overrides = {'5':None, '6':None,'3':500}\n\n # You can also set and clear overrides using indexing syntax\n vehicle.channels.overrides['2'] = 200\n vehicle.channels.overrides['2'] = None\n\n # Clear using 'del'\n del vehicle.channels.overrides['3']\n\n # Clear all overrides by setting an empty dictionary\n vehicle.channels.overrides = {}\n\n Read the channel overrides either as a dictionary or by index. Note that you'll get\n a ``KeyError`` exception if you read a channel override that has not been set.\n\n .. code:: python\n\n # Get all channel overrides\n print \" Channel overrides: %s\" % vehicle.channels.overrides\n # Print just one channel override\n print \" Ch2 override: %s\" % vehicle.channels.overrides['2']\n \"\"\"\n return self._overrides", "metadata": "root.Channels.overrides", "header": "['class', 'Channels', '(', 'dict', ')', ':', '___EOS___']", "index": 789 }, { "content": " @overrides.setter\n def overrides(self, newch):\n self._overrides._active = False\n self._overrides.clear()\n for k, v in newch.iteritems():\n if v:\n self._overrides[str(k)] = v\n else:\n try:\n del self._overrides[str(k)]\n except:\n pass\n self._overrides._active = True\n self._overrides._send()", "metadata": "root.Channels.overrides", "header": "['class', 'Channels', '(', 'dict', ')', ':', '___EOS___']", "index": 827 }, { "content": "class Locations(HasObservers):\n \"\"\"\n An object for holding location information in global, global relative and local frames.\n\n :py:class:`Vehicle` owns an object of this type. See :py:attr:`Vehicle.location` for information on\n reading and observing location in the different frames.\n\n The different frames are accessed through the members, which are created with this object.\n They can be read, and are observable.\n \"\"\"\n\n\n\n", "metadata": "root.Locations", "header": "['module', '___EOS___']", "index": 843 }, { "content": " def __init__(self, vehicle):\n super(Locations, self).__init__()\n\n self._lat = None\n self._lon = None\n self._alt = None\n self._relative_alt = None\n\n @vehicle.on_message('GLOBAL_POSITION_INT')\n def listener(vehicle, name, m):\n (self._lat, self._lon) = (m.lat / 1.0e7, m.lon / 1.0e7)\n self._relative_alt = m.relative_alt / 1000.0\n self.notify_attribute_listeners('global_relative_frame', self.global_relative_frame)\n vehicle.notify_attribute_listeners('location.global_relative_frame',\n vehicle.location.global_relative_frame)\n\n if self._alt != None or m.alt != 0:\n # Require first alt value to be non-0\n # TODO is this the proper check to do?\n self._alt = m.alt / 1000.0\n self.notify_attribute_listeners('global_frame', self.global_frame)\n vehicle.notify_attribute_listeners('location.global_frame',\n vehicle.location.global_frame)\n\n vehicle.notify_attribute_listeners('location', vehicle.location)\n\n self._north = None\n self._east = None\n self._down = None\n\n @vehicle.on_message('LOCAL_POSITION_NED')\n def listener(vehicle, name, m):\n self._north = m.x\n self._east = m.y\n self._down = m.z\n self.notify_attribute_listeners('local_frame', self.local_frame)\n vehicle.notify_attribute_listeners('location.local_frame', vehicle.location.local_frame)\n vehicle.notify_attribute_listeners('location', vehicle.location)", "metadata": "root.Locations.__init__", "header": "['class', 'Locations', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 854 }, { "content": " @property\n def local_frame(self):\n \"\"\"\n Location in local NED frame (a :py:class:`LocationGlobalRelative`).\n\n This is accessed through the :py:attr:`Vehicle.location` attribute:\n\n .. code-block:: python\n\n print \"Local Location: %s\" % vehicle.location.local_frame\n\n This location will not start to update until the vehicle is armed.\n \"\"\"\n return LocationLocal(self._north, self._east, self._down)", "metadata": "root.Locations.local_frame", "header": "['class', 'Locations', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 893 }, { "content": " @property\n def global_frame(self):\n \"\"\"\n Location in global frame (a :py:class:`LocationGlobal`).\n\n The latitude and longitude are relative to the\n `WGS84 coordinate system <http://en.wikipedia.org/wiki/World_Geodetic_System>`_.\n The altitude is relative to mean sea-level (MSL).\n\n This is accessed through the :py:attr:`Vehicle.location` attribute:\n\n .. code-block:: python\n\n print \"Global Location: %s\" % vehicle.location.global_frame\n print \"Sea level altitude is: %s\" % vehicle.location.global_frame.alt\n\n Its ``lat`` and ``lon`` attributes are populated shortly after GPS becomes available.\n The ``alt`` can take several seconds longer to populate (from the barometer).\n Listeners are not notified of changes to this attribute until it has fully populated.\n\n To watch for changes you can use :py:func:`Vehicle.on_attribute` decorator or\n :py:func:`add_attribute_listener` (decorator approach shown below):\n\n .. code-block:: python\n\n @vehicle.on_attribute('location.global_frame')\n def listener(self, attr_name, value):\n print \" Global: %s\" % value\n\n #Alternatively, use decorator: ``@vehicle.location.on_attribute('global_frame')``.\n \"\"\"\n return LocationGlobal(self._lat, self._lon, self._alt)", "metadata": "root.Locations.global_frame", "header": "['class', 'Locations', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 908 }, { "content": " @property\n def global_relative_frame(self):\n \"\"\"\n Location in global frame, with altitude relative to the home location\n (a :py:class:`LocationGlobalRelative`).\n\n The latitude and longitude are relative to the\n `WGS84 coordinate system <http://en.wikipedia.org/wiki/World_Geodetic_System>`_.\n The altitude is relative to :py:attr:`home location <Vehicle.home_location>`.\n\n This is accessed through the :py:attr:`Vehicle.location` attribute:\n\n .. code-block:: python\n\n print \"Global Location (relative altitude): %s\" % vehicle.location.global_relative_frame\n print \"Altitude relative to home_location: %s\" % vehicle.location.global_relative_frame.alt\n \"\"\"\n return LocationGlobalRelative(self._lat, self._lon, self._relative_alt)", "metadata": "root.Locations.global_relative_frame", "header": "['class', 'Locations', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 941 }, { "content": "class Vehicle(HasObservers):\n \"\"\"\n The main vehicle API.\n\n Vehicle state is exposed through 'attributes' (e.g. :py:attr:`heading`). All attributes can be\n read, and some are also settable\n (:py:attr:`mode`, :py:attr:`armed` and :py:attr:`home_location`).\n\n Attributes can also be asynchronously monitored for changes by registering listener callback\n functions.\n\n Vehicle \"settings\" (parameters) are read/set using the :py:attr:`parameters` attribute.\n Parameters can be iterated and are also individually observable.\n\n Vehicle movement is primarily controlled using the :py:attr:`armed` attribute and\n :py:func:`simple_takeoff` and :py:func:`simple_goto` in GUIDED mode.\n\n It is also possible to work with vehicle \"missions\" using the :py:attr:`commands` attribute,\n and run them in AUTO mode.\n\n The guide contains more detailed information on the different ways you can use\n the ``Vehicle`` class:\n\n - :doc:`guide/vehicle_state_and_parameters`\n - :doc:`guide/copter/guided_mode`\n - :doc:`guide/auto_mode`\n\n\n .. note::\n\n This class currently exposes just the attributes that are most commonly used by all\n vehicle types. if you need to add additional attributes then subclass ``Vehicle``\n as demonstrated in :doc:`examples/create_attribute`.\n\n Please then :doc:`contribute <contributing/contributions_api>` your additions back\n to the project!\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n #\n # Private sugar methods\n #\n\n\n\n\n #\n # Operations to support the standard API.\n #\n\n\n\n\n\n\n\n\n\n\n\n\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.Vehicle", "header": "['module', '___EOS___']", "index": 961 }, { "content": " def __init__(self, handler):\n super(Vehicle, self).__init__()\n\n self._handler = handler\n self._master = handler.master\n\n # Cache all updated attributes for wait_ready.\n # By default, we presume all \"commands\" are loaded.\n self._ready_attrs = set(['commands'])\n\n # Default parameters when calling wait_ready() or wait_ready(True).\n self._default_ready_attrs = ['parameters', 'gps_0', 'armed', 'mode', 'attitude']\n\n @self.on_attribute('*')\n def listener(_, name, value):\n self._ready_attrs.add(name)\n\n # Attaches message listeners.\n self._message_listeners = dict()\n\n @handler.forward_message\n def listener(_, msg):\n self.notify_message_listeners(msg.get_type(), msg)\n\n self._location = Locations(self)\n self._vx = None\n self._vy = None\n self._vz = None\n\n @self.on_message('GLOBAL_POSITION_INT')\n def listener(self, name, m):\n (self._vx, self._vy, self._vz) = (m.vx / 100.0, m.vy / 100.0, m.vz / 100.0)\n self.notify_attribute_listeners('velocity', self.velocity)\n\n self._pitch = None\n self._yaw = None\n self._roll = None\n self._pitchspeed = None\n self._yawspeed = None\n self._rollspeed = None\n\n @self.on_message('ATTITUDE')\n def listener(self, name, m):\n self._pitch = m.pitch\n self._yaw = m.yaw\n self._roll = m.roll\n self._pitchspeed = m.pitchspeed\n self._yawspeed = m.yawspeed\n self._rollspeed = m.rollspeed\n self.notify_attribute_listeners('attitude', self.attitude)\n\n self._heading = None\n self._airspeed = None\n self._groundspeed = None\n\n @self.on_message('VFR_HUD')\n def listener(self, name, m):\n self._heading = m.heading\n self.notify_attribute_listeners('heading', self.heading)\n self._airspeed = m.airspeed\n self.notify_attribute_listeners('airspeed', self.airspeed)\n self._groundspeed = m.groundspeed\n self.notify_attribute_listeners('groundspeed', self.groundspeed)\n\n self._rngfnd_distance = None\n self._rngfnd_voltage = None\n\n @self.on_message('RANGEFINDER')\n def listener(self, name, m):\n self._rngfnd_distance = m.distance\n self._rngfnd_voltage = m.voltage\n self.notify_attribute_listeners('rangefinder', self.rangefinder)\n\n self._mount_pitch = None\n self._mount_yaw = None\n self._mount_roll = None\n\n @self.on_message('MOUNT_STATUS')\n def listener(self, name, m):\n self._mount_pitch = m.pointing_a / 100.0\n self._mount_roll = m.pointing_b / 100.0\n self._mount_yaw = m.pointing_c / 100.0\n self.notify_attribute_listeners('mount', self.mount_status)\n\n self._capabilities = None\n self._raw_version =None\n self._autopilot_version_msg_count = 0\n\n @self.on_message('AUTOPILOT_VERSION')\n def listener(vehicle, name, m):\n self._capabilities = m.capabilities\n self._raw_version = m.flight_sw_version\n self._autopilot_version_msg_count += 1\n if self._capabilities != 0 or self._autopilot_version_msg_count > 5:\n # ArduPilot <3.4 fails to send capabilities correctly\n # straight after boot, and even older versions send\n # this back as always-0.\n vehicle.remove_message_listener('HEARTBEAT', self.send_capabilties_request)\n self.notify_attribute_listeners('autopilot_version', self._raw_version)\n\n # gimbal\n self._gimbal = Gimbal(self)\n\n # All keys are strings.\n self._channels = Channels(self, 8)\n\n @self.on_message('RC_CHANNELS_RAW')\n def listener(self, name, m):\n def set_rc(chnum, v):\n '''Private utility for handling rc channel messages'''\n # use port to allow ch nums greater than 8\n self._channels._update_channel(str(m.port * 8 + chnum), v)\n\n set_rc(1, m.chan1_raw)\n set_rc(2, m.chan2_raw)\n set_rc(3, m.chan3_raw)\n set_rc(4, m.chan4_raw)\n set_rc(5, m.chan5_raw)\n set_rc(6, m.chan6_raw)\n set_rc(7, m.chan7_raw)\n set_rc(8, m.chan8_raw)\n self.notify_attribute_listeners('channels', self.channels)\n\n self._voltage = None\n self._current = None\n self._level = None\n\n @self.on_message('SYS_STATUS')\n def listener(self, name, m):\n self._voltage = m.voltage_battery\n self._current = m.current_battery\n self._level = m.battery_remaining\n self.notify_attribute_listeners('battery', self.battery)\n\n self._eph = None\n self._epv = None\n self._satellites_visible = None\n self._fix_type = None # FIXME support multiple GPSs per vehicle - possibly by using componentId\n\n @self.on_message('GPS_RAW_INT')\n def listener(self, name, m):\n self._eph = m.eph\n self._epv = m.epv\n self._satellites_visible = m.satellites_visible\n self._fix_type = m.fix_type\n self.notify_attribute_listeners('gps_0', self.gps_0)\n\n self._current_waypoint = 0\n\n @self.on_message(['WAYPOINT_CURRENT', 'MISSION_CURRENT'])\n def listener(self, name, m):\n self._current_waypoint = m.seq\n\n self._ekf_poshorizabs = False\n self._ekf_constposmode = False\n self._ekf_predposhorizabs = False\n\n @self.on_message('EKF_STATUS_REPORT')\n def listener(self, name, m):\n # boolean: EKF's horizontal position (absolute) estimate is good\n self._ekf_poshorizabs = (m.flags & ardupilotmega.EKF_POS_HORIZ_ABS) > 0\n # boolean: EKF is in constant position mode and does not know it's absolute or relative position\n self._ekf_constposmode = (m.flags & ardupilotmega.EKF_CONST_POS_MODE) > 0\n # boolean: EKF's predicted horizontal position (absolute) estimate is good\n self._ekf_predposhorizabs = (m.flags & ardupilotmega.EKF_PRED_POS_HORIZ_ABS) > 0\n\n self.notify_attribute_listeners('ekf_ok', self.ekf_ok, cache=True)\n\n self._flightmode = 'AUTO'\n self._armed = False\n self._system_status = None\n self._autopilot_type = None#PX4, ArduPilot, etc.\n self._vehicle_type = None#quadcopter, plane, etc.\n\n @self.on_message('HEARTBEAT')\n def listener(self, name, m):\n self._armed = (m.base_mode & mavutil.mavlink.MAV_MODE_FLAG_SAFETY_ARMED) != 0\n self.notify_attribute_listeners('armed', self.armed, cache=True)\n self._autopilot_type = m.autopilot\n self._vehicle_type = m.type\n if self._is_mode_available(m.custom_mode) == False:\n raise APIException(\"mode %s not available on mavlink definition\" % m.custom_mode)\n self._flightmode = self._mode_mapping_bynumber[m.custom_mode]\n self.notify_attribute_listeners('mode', self.mode, cache=True)\n self._system_status = m.system_status\n self.notify_attribute_listeners('system_status', self.system_status, cache=True)\n\n # Waypoints.\n\n self._home_location = None\n self._wploader = mavwp.MAVWPLoader()\n self._wp_loaded = True\n self._wp_uploaded = None\n self._wpts_dirty = False\n self._commands = CommandSequence(self)\n\n @self.on_message(['WAYPOINT_COUNT', 'MISSION_COUNT'])\n def listener(self, name, msg):\n if not self._wp_loaded:\n self._wploader.clear()\n self._wploader.expected_count = msg.count\n self._master.waypoint_request_send(0)\n\n @self.on_message(['WAYPOINT', 'MISSION_ITEM'])\n def listener(self, name, msg):\n if not self._wp_loaded:\n if msg.seq == 0:\n if not (msg.x == 0 and msg.y == 0 and msg.z == 0):\n self._home_location = LocationGlobal(msg.x, msg.y, msg.z)\n\n if msg.seq > self._wploader.count():\n # Unexpected waypoint\n pass\n elif msg.seq < self._wploader.count():\n # Waypoint duplicate\n pass\n else:\n self._wploader.add(msg)\n\n if msg.seq + 1 < self._wploader.expected_count:\n self._master.waypoint_request_send(msg.seq + 1)\n else:\n self._wp_loaded = True\n self.notify_attribute_listeners('commands', self.commands)\n\n # Waypoint send to master\n @self.on_message(['WAYPOINT_REQUEST', 'MISSION_REQUEST'])\n def listener(self, name, msg):\n if self._wp_uploaded != None:\n wp = self._wploader.wp(msg.seq)\n handler.fix_targets(wp)\n self._master.mav.send(wp)\n self._wp_uploaded[msg.seq] = True\n\n # TODO: Waypoint loop listeners\n\n # Parameters.\n\n start_duration = 0.2\n repeat_duration = 1\n\n self._params_count = -1\n self._params_set = []\n self._params_loaded = False\n self._params_start = False\n self._params_map = {}\n self._params_last = monotonic.monotonic() # Last new param.\n self._params_duration = start_duration\n self._parameters = Parameters(self)\n\n @handler.forward_loop\n def listener(_):\n # Check the time duration for last \"new\" params exceeds watchdog.\n if not self._params_start:\n return\n\n if None not in self._params_set and not self._params_loaded:\n self._params_loaded = True\n self.notify_attribute_listeners('parameters', self.parameters)\n\n if not self._params_loaded and monotonic.monotonic() - self._params_last > self._params_duration:\n c = 0\n for i, v in enumerate(self._params_set):\n if v == None:\n self._master.mav.param_request_read_send(0, 0, '', i)\n c += 1\n if c > 50:\n break\n self._params_duration = repeat_duration\n self._params_last = monotonic.monotonic()\n\n @self.on_message(['PARAM_VALUE'])\n def listener(self, name, msg):\n # If we discover a new param count, assume we\n # are receiving a new param set.\n if self._params_count != msg.param_count:\n self._params_loaded = False\n self._params_start = True\n self._params_count = msg.param_count\n self._params_set = [None] * msg.param_count\n\n # Attempt to set the params. We throw an error\n # if the index is out of range of the count or\n # we lack a param_id.\n try:\n if msg.param_index < msg.param_count and msg:\n if self._params_set[msg.param_index] == None:\n self._params_last = monotonic.monotonic()\n self._params_duration = start_duration\n self._params_set[msg.param_index] = msg\n self._params_map[msg.param_id] = msg.param_value\n self._parameters.notify_attribute_listeners(msg.param_id, msg.param_value,\n cache=True)\n except:\n import traceback\n traceback.print_exc()\n\n # Heartbeats.\n\n self._heartbeat_started = False\n self._heartbeat_lastsent = 0\n self._heartbeat_lastreceived = 0\n self._heartbeat_timeout = False\n\n self._heartbeat_warning = 5\n self._heartbeat_error = 30\n self._heartbeat_system = None\n\n @handler.forward_loop\n def listener(_):\n # Send 1 heartbeat per second\n if monotonic.monotonic() - self._heartbeat_lastsent > 1:\n self._master.mav.heartbeat_send(mavutil.mavlink.MAV_TYPE_GCS,\n mavutil.mavlink.MAV_AUTOPILOT_INVALID, 0, 0, 0)\n self._heartbeat_lastsent = monotonic.monotonic()\n\n # Timeouts.\n if self._heartbeat_started:\n if self._heartbeat_error and self._heartbeat_error > 0 and monotonic.monotonic(\n ) - self._heartbeat_lastreceived > self._heartbeat_error:\n raise APIException('No heartbeat in %s seconds, aborting.' %\n self._heartbeat_error)\n elif monotonic.monotonic() - self._heartbeat_lastreceived > self._heartbeat_warning:\n if self._heartbeat_timeout == False:\n errprinter('>>> Link timeout, no heartbeat in last %s seconds' %\n self._heartbeat_warning)\n self._heartbeat_timeout = True\n\n @self.on_message(['HEARTBEAT'])\n def listener(self, name, msg):\n self._heartbeat_system = msg.get_srcSystem()\n self._heartbeat_lastreceived = monotonic.monotonic()\n if self._heartbeat_timeout:\n errprinter('>>> ...link restored.')\n self._heartbeat_timeout = False\n\n self._last_heartbeat = None\n\n @handler.forward_loop\n def listener(_):\n if self._heartbeat_lastreceived:\n self._last_heartbeat = monotonic.monotonic() - self._heartbeat_lastreceived\n self.notify_attribute_listeners('last_heartbeat', self.last_heartbeat)", "metadata": "root.Vehicle.__init__", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 999 }, { "content": " @property\n def last_heartbeat(self):\n \"\"\"\n Time since last MAVLink heartbeat was received (in seconds).\n\n The attribute can be used to monitor link activity and implement script-specific timeout handling.\n\n For example, to pause the script if no heartbeat is received for more than 1 second you might implement\n the following observer, and use ``pause_script`` in a program loop to wait until the link is recovered:\n\n .. code-block:: python\n\n pause_script=False\n\n @vehicle.on_attribute('last_heartbeat')\n def listener(self, attr_name, value):\n global pause_script\n if value > 1 and not pause_script:\n print \"Pausing script due to bad link\"\n pause_script=True;\n if value < 1 and pause_script:\n pause_script=False;\n print \"Un-pausing script\"\n\n The observer will be called at the period of the messaging loop (about every 0.01 seconds). Testing\n on SITL indicates that ``last_heartbeat`` averages about .5 seconds, but will rarely exceed 1.5 seconds\n when connected. Whether heartbeat monitoring can be useful will very much depend on the application.\n\n\n .. note::\n\n If you just want to change the heartbeat timeout you can modify the ``heartbeat_timeout``\n parameter passed to the :py:func:`connect() <dronekit.connect>` function.\n\n \"\"\"\n return self._last_heartbeat", "metadata": "root.Vehicle.last_heartbeat", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1343 }, { "content": " def on_message(self, name):\n \"\"\"\n Decorator for message listener callback functions.\n\n .. tip::\n\n This is the most elegant way to define message listener callback functions.\n Use :py:func:`add_message_listener` only if you need to be able to\n :py:func:`remove the listener <remove_message_listener>` later.\n\n A decorated message listener function is called with three arguments every time the\n specified message is received:\n\n * ``self`` - the current vehicle.\n * ``name`` - the name of the message that was intercepted.\n * ``message`` - the actual message (a `pymavlink <http://www.qgroundcontrol.org/mavlink/pymavlink>`_\n `class <https://www.samba.org/tridge/UAV/pymavlink/apidocs/classIndex.html>`_).\n\n For example, in the fragment below ``my_method`` will be called for every heartbeat message:\n\n .. code:: python\n\n @vehicle.on_message('HEARTBEAT')\n def my_method(self, name, msg):\n pass\n\n See :ref:`mavlink_messages` for more information.\n\n :param String name: The name of the message to be intercepted by the decorated listener function (or '*' to get all messages).\n \"\"\"\n\n def decorator(fn):\n if isinstance(name, list):\n for n in name:\n self.add_message_listener(n, fn)\n else:\n self.add_message_listener(name, fn)\n\n return decorator", "metadata": "root.Vehicle.on_message", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1380 }, { "content": " def add_message_listener(self, name, fn):\n \"\"\"\n Adds a message listener function that will be called every time the specified message is received.\n\n .. tip::\n\n We recommend you use :py:func:`on_message` instead of this method as it has a more elegant syntax.\n This method is only preferred if you need to be able to\n :py:func:`remove the listener <remove_message_listener>`.\n\n The callback function must have three arguments:\n\n * ``self`` - the current vehicle.\n * ``name`` - the name of the message that was intercepted.\n * ``message`` - the actual message (a `pymavlink <http://www.qgroundcontrol.org/mavlink/pymavlink>`_\n `class <https://www.samba.org/tridge/UAV/pymavlink/apidocs/classIndex.html>`_).\n\n For example, in the fragment below ``my_method`` will be called for every heartbeat message:\n\n .. code:: python\n\n #Callback method for new messages\n def my_method(self, name, msg):\n pass\n\n vehicle.add_message_listener('HEARTBEAT',my_method)\n\n See :ref:`mavlink_messages` for more information.\n\n :param String name: The name of the message to be intercepted by the listener function (or '*' to get all messages).\n :param fn: The listener function that will be called if a message is received.\n \"\"\"\n name = str(name)\n if name not in self._message_listeners:\n self._message_listeners[name] = []\n if fn not in self._message_listeners[name]:\n self._message_listeners[name].append(fn)", "metadata": "root.Vehicle.add_message_listener", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1420 }, { "content": " def remove_message_listener(self, name, fn):\n \"\"\"\n Removes a message listener (that was previously added using :py:func:`add_message_listener`).\n\n See :ref:`mavlink_messages` for more information.\n\n :param String name: The name of the message for which the listener is to be removed (or '*' to remove an 'all messages' observer).\n :param fn: The listener callback function to remove.\n\n \"\"\"\n name = str(name)\n if name in self._message_listeners:\n if fn in self._message_listeners[name]:\n self._message_listeners[name].remove(fn)\n if len(self._message_listeners[name]) == 0:\n del self._message_listeners[name]", "metadata": "root.Vehicle.remove_message_listener", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1458 }, { "content": " def notify_message_listeners(self, name, msg):\n for fn in self._message_listeners.get(name, []):\n try:\n fn(self, name, msg)\n except Exception as e:\n errprinter('>>> Exception in message handler for %s' %\n msg.get_type())\n errprinter('>>> ' + str(e))\n\n for fn in self._message_listeners.get('*', []):\n try:\n fn(self, name, msg)\n except Exception as e:\n errprinter('>>> Exception in message handler for %s' %\n msg.get_type())\n errprinter('>>> ' + str(e))", "metadata": "root.Vehicle.notify_message_listeners", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1475 }, { "content": " def close(self):\n return self._handler.close()", "metadata": "root.Vehicle.close", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1493 }, { "content": " def flush(self):\n \"\"\"\n Call ``flush()`` after :py:func:`adding <CommandSequence.add>` or :py:func:`clearing <CommandSequence.clear>` mission commands.\n\n After the return from ``flush()`` any writes are guaranteed to have completed (or thrown an\n exception) and future reads will see their effects.\n\n .. warning::\n\n This method is deprecated. It has been replaced by\n :py:func:`Vehicle.commands.upload() <Vehicle.commands.upload>`.\n \"\"\"\n return self.commands.upload()", "metadata": "root.Vehicle.flush", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1496 }, { "content": " @property\n def _mode_mapping(self):\n return self._master.mode_mapping()", "metadata": "root.Vehicle._mode_mapping", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1514 }, { "content": " @property\n def _mode_mapping_bynumber(self):\n return mavutil.mode_mapping_bynumber(self._vehicle_type)", "metadata": "root.Vehicle._mode_mapping_bynumber", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1518 }, { "content": " def _is_mode_available(self, mode_code):\n try:\n return mode_code in self._mode_mapping_bynumber\n except:\n return False", "metadata": "root.Vehicle._is_mode_available", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1522 }, { "content": " @property\n def mode(self):\n \"\"\"\n This attribute is used to get and set the current flight mode (:py:class:`VehicleMode`).\n \"\"\"\n if not self._flightmode:\n return None\n return VehicleMode(self._flightmode)", "metadata": "root.Vehicle.mode", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1532 }, { "content": " @mode.setter\n def mode(self, v):\n self._master.set_mode(self._mode_mapping[v.name])", "metadata": "root.Vehicle.mode", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1541 }, { "content": " @property\n def location(self):\n \"\"\"\n The vehicle location in global, global relative and local frames (:py:class:`Locations`).\n\n The different frames are accessed through its members:\n\n * :py:attr:`global_frame <dronekit.Locations.global_frame>` (:py:class:`LocationGlobal`)\n * :py:attr:`global_relative_frame <dronekit.Locations.global_relative_frame>` (:py:class:`LocationGlobalRelative`)\n * :py:attr:`local_frame <dronekit.Locations.local_frame>` (:py:class:`LocationLocal`)\n\n For example, to print the location in each frame for a ``vehicle``:\n\n .. code-block:: python\n\n # Print location information for `vehicle` in all frames (default printer)\n print \"Global Location: %s\" % vehicle.location.global_frame\n print \"Global Location (relative altitude): %s\" % vehicle.location.global_relative_frame\n print \"Local Location: %s\" % vehicle.location.local_frame #NED\n\n # Print altitudes in the different frames (see class definitions for other available information)\n print \"Altitude (global frame): %s\" % vehicle.location.global_frame.alt\n print \"Altitude (global relative frame): %s\" % vehicle.location.global_relative_frame.alt\n print \"Altitude (NED frame): %s\" % vehicle.location.local_frame.down\n\n .. note::\n\n All the location \"values\" (e.g. ``global_frame.lat``) are initially\n created with value ``None``. The ``global_frame``, ``global_relative_frame``\n latitude and longitude values are populated shortly after initialisation but\n ``global_frame.alt`` may take a few seconds longer to be updated.\n The ``local_frame`` does not populate until the vehicle is armed.\n\n The attribute and its members are observable. To watch for changes in all frames using a listener\n created using a decorator (you can also define a listener and explicitly add it).\n\n .. code-block:: python\n\n @vehicle.on_attribute('location')\n def listener(self, attr_name, value):\n # `self`: :py:class:`Vehicle` object that has been updated.\n # `attr_name`: name of the observed attribute - 'location'\n # `value` is the updated attribute value (a :py:class:`Locations`). This can be queried for the frame information\n print \" Global: %s\" % value.global_frame\n print \" GlobalRelative: %s\" % value.global_relative_frame\n print \" Local: %s\" % value.local_frame\n\n To watch for changes in just one attribute (in this case ``global_frame``):\n\n .. code-block:: python\n\n @vehicle.on_attribute('location.global_frame')\n def listener(self, attr_name, value):\n # `self`: :py:class:`Locations` object that has been updated.\n # `attr_name`: name of the observed attribute - 'global_frame'\n # `value` is the updated attribute value.\n print \" Global: %s\" % value\n\n #Or watch using decorator: ``@vehicle.location.on_attribute('global_frame')``.\n \"\"\"\n return self._location", "metadata": "root.Vehicle.location", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1545 }, { "content": " @property\n def battery(self):\n \"\"\"\n Current system batter status (:py:class:`Battery`).\n \"\"\"\n if self._voltage == None or self._current == None or self._level == None:\n return None\n return Battery(self._voltage, self._current, self._level)", "metadata": "root.Vehicle.battery", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1607 }, { "content": " @property\n def rangefinder(self):\n \"\"\"\n Rangefinder distance and voltage values (:py:class:`Rangefinder`).\n \"\"\"\n return Rangefinder(self._rngfnd_distance, self._rngfnd_voltage)", "metadata": "root.Vehicle.rangefinder", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1616 }, { "content": " @property\n def velocity(self):\n \"\"\"\n Current velocity as a three element list ``[ vx, vy, vz ]`` (in meter/sec).\n \"\"\"\n return [self._vx, self._vy, self._vz]", "metadata": "root.Vehicle.velocity", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1623 }, { "content": " @property\n def version(self):\n \"\"\"\n The autopilot version and type in a :py:class:`Version` object.\n\n .. versionadded:: 2.0.3\n \"\"\"\n return Version(self._raw_version, self._autopilot_type, self._vehicle_type)", "metadata": "root.Vehicle.version", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1630 }, { "content": " @property\n def capabilities(self):\n \"\"\"\n The autopilot capabilities in a :py:class:`Capabilities` object.\n\n .. versionadded:: 2.0.3\n \"\"\"\n return Capabilities(self._capabilities)", "metadata": "root.Vehicle.capabilities", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1639 }, { "content": " @property\n def attitude(self):\n \"\"\"\n Current vehicle attitude - pitch, yaw, roll (:py:class:`Attitude`).\n \"\"\"\n return Attitude(self._pitch, self._yaw, self._roll)", "metadata": "root.Vehicle.attitude", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1648 }, { "content": " @property\n def gps_0(self):\n \"\"\"\n GPS position information (:py:class:`GPSInfo`).\n \"\"\"\n return GPSInfo(self._eph, self._epv, self._fix_type, self._satellites_visible)", "metadata": "root.Vehicle.gps_0", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1655 }, { "content": " @property\n def armed(self):\n \"\"\"\n This attribute can be used to get and set the ``armed`` state of the vehicle (``boolean``).\n\n The code below shows how to read the state, and to arm/disarm the vehicle:\n\n .. code:: python\n\n # Print the armed state for the vehicle\n print \"Armed: %s\" % vehicle.armed\n\n # Disarm the vehicle\n vehicle.armed = False\n\n # Arm the vehicle\n vehicle.armed = True\n \"\"\"\n return self._armed", "metadata": "root.Vehicle.armed", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1662 }, { "content": " @armed.setter\n def armed(self, value):\n if bool(value) != self._armed:\n if value:\n self._master.arducopter_arm()\n else:\n self._master.arducopter_disarm()", "metadata": "root.Vehicle.armed", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1682 }, { "content": " @property\n def is_armable(self):\n \"\"\"\n Returns ``True`` if the vehicle is ready to arm, false otherwise (``Boolean``).\n\n This attribute wraps a number of pre-arm checks, ensuring that the vehicle has booted,\n has a good GPS fix, and that the EKF pre-arm is complete.\n \"\"\"\n # check that mode is not INITIALSING\n # check that we have a GPS fix\n # check that EKF pre-arm is complete\n return self.mode != 'INITIALISING' and self.gps_0.fix_type > 1 and self._ekf_predposhorizabs", "metadata": "root.Vehicle.is_armable", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1690 }, { "content": " @property\n def system_status(self):\n \"\"\"\n System status (:py:class:`SystemStatus`).\n\n The status has a ``state`` property with one of the following values:\n\n * ``UNINIT``: Uninitialized system, state is unknown.\n * ``BOOT``: System is booting up.\n * ``CALIBRATING``: System is calibrating and not flight-ready.\n * ``STANDBY``: System is grounded and on standby. It can be launched any time.\n * ``ACTIVE``: System is active and might be already airborne. Motors are engaged.\n * ``CRITICAL``: System is in a non-normal flight mode. It can however still navigate.\n * ``EMERGENCY``: System is in a non-normal flight mode. It lost control over parts\n or over the whole airframe. It is in mayday and going down.\n * ``POWEROFF``: System just initialized its power-down sequence, will shut down now.\n \"\"\"\n return {\n 0: SystemStatus('UNINIT'),\n 1: SystemStatus('BOOT'),\n 2: SystemStatus('CALIBRATING'),\n 3: SystemStatus('STANDBY'),\n 4: SystemStatus('ACTIVE'),\n 5: SystemStatus('CRITICAL'),\n 6: SystemStatus('EMERGENCY'),\n 7: SystemStatus('POWEROFF'),\n }.get(self._system_status, None)", "metadata": "root.Vehicle.system_status", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1703 }, { "content": " @property\n def heading(self):\n \"\"\"\n Current heading in degrees - 0..360, where North = 0 (``int``).\n \"\"\"\n return self._heading", "metadata": "root.Vehicle.heading", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1731 }, { "content": " @property\n def groundspeed(self):\n \"\"\"\n Current groundspeed in metres/second (``double``).\n\n This attribute is settable. The set value is the default target groundspeed\n when moving the vehicle using :py:func:`simple_goto` (or other position-based\n movement commands).\n \"\"\"\n return self._groundspeed", "metadata": "root.Vehicle.groundspeed", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1738 }, { "content": " @groundspeed.setter\n def groundspeed(self, speed):\n speed_type = 1 # ground speed\n msg = self.message_factory.command_long_encode(\n 0, 0, # target system, target component\n mavutil.mavlink.MAV_CMD_DO_CHANGE_SPEED, #command\n 0, #confirmation\n speed_type, #param 1\n speed, # speed in metres/second\n -1, 0, 0, 0, 0 #param 3 - 7\n )\n\n # send command to vehicle\n self.send_mavlink(msg)", "metadata": "root.Vehicle.groundspeed", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1749 }, { "content": " @property\n def airspeed(self):\n \"\"\"\n Current airspeed in metres/second (``double``).\n\n This attribute is settable. The set value is the default target airspeed\n when moving the vehicle using :py:func:`simple_goto` (or other position-based\n movement commands).\n \"\"\"\n return self._airspeed", "metadata": "root.Vehicle.airspeed", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1765 }, { "content": " @airspeed.setter\n def airspeed(self, speed):\n speed_type = 0 # air speed\n msg = self.message_factory.command_long_encode(\n 0, 0, # target system, target component\n mavutil.mavlink.MAV_CMD_DO_CHANGE_SPEED, #command\n 0, #confirmation\n speed_type, #param 1\n speed, # speed in metres/second\n -1, 0, 0, 0, 0 #param 3 - 7\n )\n\n # send command to vehicle\n self.send_mavlink(msg)", "metadata": "root.Vehicle.airspeed", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1776 }, { "content": " @property\n def gimbal(self):\n \"\"\"\n Gimbal object for controlling, viewing and observing gimbal status (:py:class:`Gimbal`).\n\n .. versionadded:: 2.0.1\n \"\"\"\n return self._gimbal", "metadata": "root.Vehicle.gimbal", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1791 }, { "content": " @property\n def mount_status(self):\n \"\"\"\n .. warning:: This method is deprecated. It has been replaced by :py:attr:`gimbal`.\n\n Current status of the camera mount (gimbal) as a three element list: ``[ pitch, yaw, roll ]``.\n\n The values in the list are set to ``None`` if no mount is configured.\n \"\"\"\n return [self._mount_pitch, self._mount_yaw, self._mount_roll]", "metadata": "root.Vehicle.mount_status", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1800 }, { "content": " @property\n def ekf_ok(self):\n \"\"\"\n ``True`` if the EKF status is considered acceptable, ``False`` otherwise (``boolean``).\n \"\"\"\n # legacy check for dronekit-python for solo\n # use same check that ArduCopter::system.pde::position_ok() is using\n if self.armed:\n return self._ekf_poshorizabs and not self._ekf_constposmode\n else:\n return self._ekf_poshorizabs or self._ekf_predposhorizabs", "metadata": "root.Vehicle.ekf_ok", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1811 }, { "content": " @property\n def channels(self):\n \"\"\"\n The RC channel values from the RC Transmitter (:py:class:`Channels`).\n\n The attribute can also be used to set and read RC Override (channel override) values\n via :py:attr:`Vehicle.channels.override <dronekit.Channels.overrides>`.\n\n For more information and examples see :ref:`example_channel_overrides`.\n\n To read the channels from the RC transmitter:\n\n .. code:: python\n\n # Get all channel values from RC transmitter\n print \"Channel values from RC Tx:\", vehicle.channels\n\n # Access channels individually\n print \"Read channels individually:\"\n print \" Ch1: %s\" % vehicle.channels['1']\n print \" Ch2: %s\" % vehicle.channels['2']\n\n \"\"\"\n return self._channels", "metadata": "root.Vehicle.channels", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1823 }, { "content": " @property\n def home_location(self):\n \"\"\"\n The current home location (:py:class:`LocationGlobal`).\n\n To get the attribute you must first download the :py:func:`Vehicle.commands`.\n The attribute has a value of ``None`` until :py:func:`Vehicle.commands` has been downloaded\n **and** the autopilot has set an initial home location (typically where the vehicle first gets GPS lock).\n\n .. code-block:: python\n\n #Connect to a vehicle object (for example, on com14)\n vehicle = connect('com14', wait_ready=True)\n\n # Download the vehicle waypoints (commands). Wait until download is complete.\n cmds = vehicle.commands\n cmds.download()\n cmds.wait_ready()\n\n # Get the home location\n home = vehicle.home_location\n\n The ``home_location`` is not observable.\n\n The attribute can be written (in the same way as any other attribute) after it has successfully\n been populated from the vehicle. The value sent to the vehicle is cached in the attribute\n (and can potentially get out of date if you don't re-download ``Vehicle.commands``):\n\n .. warning::\n\n Setting the value will fail silently if the specified location is more than 50km from the EKF origin.\n\n\n \"\"\"\n return copy.copy(self._home_location)", "metadata": "root.Vehicle.home_location", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1848 }, { "content": " @home_location.setter\n def home_location(self, pos):\n \"\"\"\n Sets the home location (``LocationGlobal``).\n\n The value cannot be set until it has successfully been read from the vehicle. After being\n set the value is cached in the home_location attribute and does not have to be re-read.\n\n .. note::\n\n Setting the value will fail silently if the specified location is more than 50km from the EKF origin.\n \"\"\"\n\n if not isinstance(pos, LocationGlobal):\n raise Exception('Excepting home_location to be set to a LocationGlobal.')\n\n # Set cached home location.\n self._home_location = copy.copy(pos)\n\n # Send MAVLink update.\n self.send_mavlink(self.message_factory.command_long_encode(\n 0, 0, # target system, target component\n mavutil.mavlink.MAV_CMD_DO_SET_HOME, # command\n 0, # confirmation\n 2, # param 1: 1 to use current position, 2 to use the entered values.\n 0, 0, 0, # params 2-4\n pos.lat, pos.lon, pos.alt))", "metadata": "root.Vehicle.home_location", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1884 }, { "content": " @property\n def commands(self):\n \"\"\"\n Gets the editable waypoints/current mission for this vehicle (:py:class:`CommandSequence`).\n\n This can be used to get, create, and modify a mission.\n\n :returns: A :py:class:`CommandSequence` containing the waypoints for this vehicle.\n \"\"\"\n return self._commands", "metadata": "root.Vehicle.commands", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1912 }, { "content": " @property\n def parameters(self):\n \"\"\"\n The (editable) parameters for this vehicle (:py:class:`Parameters`).\n \"\"\"\n return self._parameters", "metadata": "root.Vehicle.parameters", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1923 }, { "content": " def simple_takeoff(self, alt=None):\n \"\"\"\n Take off and fly the vehicle to the specified altitude (in metres) and then wait for another command.\n\n .. note::\n\n This function should only be used on Copter vehicles.\n\n\n The vehicle must be in GUIDED mode and armed before this is called.\n\n There is no mechanism for notification when the correct altitude is reached,\n and if another command arrives before that point (e.g. :py:func:`simple_goto`) it will be run instead.\n\n .. warning::\n\n Apps should code to ensure that the vehicle will reach a safe altitude before\n other commands are executed. A good example is provided in the guide topic :doc:`guide/taking_off`.\n\n :param alt: Target height, in metres.\n \"\"\"\n if alt is not None:\n altitude = float(alt)\n if math.isnan(alt) or math.isinf(alt):\n raise ValueError(\"Altitude was NaN or Infinity. Please provide a real number\")\n self._master.mav.command_long_send(0, 0, mavutil.mavlink.MAV_CMD_NAV_TAKEOFF,\n 0, 0, 0, 0, 0, 0, 0, altitude)", "metadata": "root.Vehicle.simple_takeoff", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1931 }, { "content": " def simple_goto(self, location, airspeed=None, groundspeed=None):\n '''\n Go to a specified global location (:py:class:`LocationGlobal` or :py:class:`LocationGlobalRelative`).\n\n There is no mechanism for notification when the target location is reached, and if another command arrives\n before that point that will be executed immediately.\n\n You can optionally set the desired airspeed or groundspeed (this is identical to setting\n :py:attr:`airspeed` or :py:attr:`groundspeed`). The vehicle will determine what speed to\n use if the values are not set or if they are both set.\n\n The method will change the :py:class:`VehicleMode` to ``GUIDED`` if necessary.\n\n .. code:: python\n\n # Set mode to guided - this is optional as the simple_goto method will change the mode if needed.\n vehicle.mode = VehicleMode(\"GUIDED\")\n\n # Set the LocationGlobal to head towards\n a_location = LocationGlobal(-34.364114, 149.166022, 30)\n vehicle.simple_goto(a_location)\n\n :param location: The target location (:py:class:`LocationGlobal` or :py:class:`LocationGlobalRelative`).\n :param airspeed: Target airspeed in m/s (optional).\n :param groundspeed: Target groundspeed in m/s (optional).\n '''\n if isinstance(location, LocationGlobalRelative):\n frame = mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT\n alt = location.alt\n elif isinstance(location, LocationGlobal):\n # This should be the proper code:\n # frame = mavutil.mavlink.MAV_FRAME_GLOBAL\n # However, APM discards information about the relative frame\n # and treats any alt value as relative. So we compensate here.\n frame = mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT\n if not self.home_location:\n self.commands.download()\n self.commands.wait_ready()\n alt = location.alt - self.home_location.alt\n else:\n raise APIException('Expecting location to be LocationGlobal or LocationGlobalRelative.')\n\n self._master.mav.mission_item_send(0, 0, 0, frame,\n mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 2, 0, 0,\n 0, 0, 0, location.lat, location.lon,\n alt)\n\n if airspeed != None:\n self.airspeed = airspeed\n if groundspeed != None:\n self.groundspeed = groundspeed", "metadata": "root.Vehicle.simple_goto", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1959 }, { "content": " def send_mavlink(self, message):\n \"\"\"\n This method is used to send raw MAVLink \"custom messages\" to the vehicle.\n\n The function can send arbitrary messages/commands to the connected vehicle at any time and in any vehicle mode.\n It is particularly useful for controlling vehicles outside of missions (for example, in GUIDED mode).\n\n The :py:func:`message_factory <dronekit.Vehicle.message_factory>` is used to create messages in the appropriate format.\n\n For more information see the guide topic: :ref:`guided_mode_how_to_send_commands`.\n\n :param message: A ``MAVLink_message`` instance, created using :py:func:`message_factory <dronekit.Vehicle.message_factory>`.\n There is need to specify the system id, component id or sequence number of messages as the API will set these appropriately.\n \"\"\"\n self._master.mav.send(message)", "metadata": "root.Vehicle.send_mavlink", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 2011 }, { "content": " @property\n def message_factory(self):\n \"\"\"\n Returns an object that can be used to create 'raw' MAVLink messages that are appropriate for this vehicle.\n The message can then be sent using :py:func:`send_mavlink(message) <dronekit.Vehicle.send_mavlink>`.\n\n .. note::\n\n Vehicles support a subset of the messages defined in the MAVLink standard. For more information\n about the supported sets see wiki topics:\n `Copter Commands in Guided Mode <http://dev.ardupilot.com/wiki/copter-commands-in-guided-mode/>`_\n and `Plane Commands in Guided Mode <http://dev.ardupilot.com/wiki/plane-commands-in-guided-mode/>`_.\n\n All message types are defined in the central MAVLink github repository. For example, a Pixhawk understands\n the following messages (from `pixhawk.xml <https://github.com/mavlink/mavlink/blob/master/message_definitions/v1.0/pixhawk.xml>`_):\n\n .. code:: xml\n\n <message id=\"153\" name=\"IMAGE_TRIGGER_CONTROL\">\n <field type=\"uint8_t\" name=\"enable\">0 to disable, 1 to enable</field>\n </message>\n\n The name of the factory method will always be the lower case version of the message name with *_encode* appended.\n Each field in the XML message definition must be listed as arguments to this factory method. So for this example\n message, the call would be:\n\n .. code:: python\n\n msg = vehicle.message_factory.image_trigger_control_encode(True)\n vehicle.send_mavlink(msg)\n\n Some message types include \"addressing information\". If present, there is no need to specify the ``target_system``\n id (just set to zero) as DroneKit will automatically update messages with the correct ID for the connected\n vehicle before sending.\n The ``target_component`` should be set to 0 (broadcast) unless the message is to specific component.\n CRC fields and sequence numbers (if defined in the message type) are automatically set by DroneKit and can also\n be ignored/set to zero.\n\n For more information see the guide topic: :ref:`guided_mode_how_to_send_commands`.\n \"\"\"\n return self._master.mav", "metadata": "root.Vehicle.message_factory", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 2027 }, { "content": " def initialize(self, rate=4, heartbeat_timeout=30):\n self._handler.start()\n\n # Start heartbeat polling.\n start = monotonic.monotonic()\n self._heartbeat_error = heartbeat_timeout or 0\n self._heartbeat_started = True\n self._heartbeat_lastreceived = start\n\n # Poll for first heartbeat.\n # If heartbeat times out, this will interrupt.\n while self._handler._alive:\n time.sleep(.1)\n if self._heartbeat_lastreceived != start:\n break\n if not self._handler._alive:\n raise APIException('Timeout in initializing connection.')\n\n # Register target_system now.\n self._handler.target_system = self._heartbeat_system\n\n # Wait until board has booted.\n while True:\n if self._flightmode not in [None, 'INITIALISING', 'MAV']:\n break\n time.sleep(0.1)\n\n # Initialize data stream.\n if rate != None:\n self._master.mav.request_data_stream_send(0, 0, mavutil.mavlink.MAV_DATA_STREAM_ALL,\n rate, 1)\n\n self.add_message_listener('HEARTBEAT', self.send_capabilties_request)\n\n # Ensure initial parameter download has started.\n while True:\n # This fn actually rate limits itself to every 2s.\n # Just retry with persistence to get our first param stream.\n self._master.param_fetch_all()\n time.sleep(0.1)\n if self._params_count > -1:\n break", "metadata": "root.Vehicle.initialize", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 2069 }, { "content": " def send_capabilties_request(self, vehicle, name, m):\n '''Request an AUTOPILOT_VERSION packet'''\n capability_msg = vehicle.message_factory.command_long_encode(0, 0, mavutil.mavlink.MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES, 0, 1, 0, 0, 0, 0, 0, 0)\n vehicle.send_mavlink(capability_msg)", "metadata": "root.Vehicle.send_capabilties_request", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 2112 }, { "content": " def wait_ready(self, *types, **kwargs):\n \"\"\"\n Waits for specified attributes to be populated from the vehicle (values are initially ``None``).\n\n This is typically called \"behind the scenes\" to ensure that :py:func:`connect` does not return until\n attributes have populated (via the ``wait_ready`` parameter). You can also use it after connecting to\n wait on a specific value(s).\n\n There are two ways to call the method:\n\n .. code-block:: python\n\n #Wait on default attributes to populate\n vehicle.wait_ready(True)\n\n #Wait on specified attributes (or array of attributes) to populate\n vehicle.wait_ready('mode','airspeed')\n\n Using the ``wait_ready(True)`` waits on :py:attr:`parameters`, :py:attr:`gps_0`,\n :py:attr:`armed`, :py:attr:`mode`, and :py:attr:`attitude`. In practice this usually\n means that all supported attributes will be populated.\n\n By default, the method will timeout after 30 seconds and raise an exception if the\n attributes were not populated.\n\n :param types: ``True`` to wait on the default set of attributes, or a\n comma-separated list of the specific attributes to wait on.\n :param int timeout: Timeout in seconds after which the method will raise an exception\n (the default) or return ``False``. The default timeout is 30 seconds.\n :param Boolean raise_exception: If ``True`` the method will raise an exception on timeout,\n otherwise the method will return ``False``. The default is ``True`` (raise exception).\n \"\"\"\n timeout = kwargs.get('timeout', 30)\n raise_exception = kwargs.get('raise_exception', True)\n\n # Vehicle defaults for wait_ready(True) or wait_ready()\n if list(types) == [True] or list(types) == []:\n types = self._default_ready_attrs\n\n if not all(isinstance(item, basestring) for item in types):\n raise APIException('wait_ready expects one or more string arguments.')\n\n # Wait for these attributes to have been set.\n await = set(types)\n start = monotonic.monotonic()\n while not await.issubset(self._ready_attrs):\n time.sleep(0.1)\n if monotonic.monotonic() - start > timeout:\n if raise_exception:\n raise APIException('wait_ready experienced a timeout after %s seconds.' %\n timeout)\n else:\n return False\n\n return True", "metadata": "root.Vehicle.wait_ready", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 2117 }, { "content": "class Gimbal(object):\n \"\"\"\n Gimbal status and control.\n\n An object of this type is returned by :py:attr:`Vehicle.gimbal`. The\n gimbal orientation can be obtained from its :py:attr:`roll`, :py:attr:`pitch` and\n :py:attr:`yaw` attributes.\n\n The gimbal orientation can be set explicitly using :py:func:`rotate`\n or you can set the gimbal (and vehicle) to track a specific \"region of interest\" using\n :py:func:`target_location`.\n\n .. note::\n\n * The orientation attributes are created with values of ``None``. If a gimbal is present,\n the attributes are populated shortly after initialisation by messages from the autopilot.\n * The attribute values reflect the last gimbal setting-values rather than actual measured values.\n This means that the values won't change if you manually move the gimbal, and that the value\n will change when you set it, even if the specified orientation is not supported.\n * A gimbal may not support all axes of rotation. For example, the Solo gimbal will set pitch\n values from 0 to -90 (straight ahead to straight down), it will rotate the vehicle to follow specified\n yaw values, and will ignore roll commands (not supported).\n \"\"\"\n\n\n\n\n\n\n\n", "metadata": "root.Gimbal", "header": "['module', '___EOS___']", "index": 2174 }, { "content": " def __init__(self, vehicle):\n super(Gimbal, self).__init__()\n\n self._pitch = None\n self._roll = None\n self._yaw = None\n self._vehicle = vehicle\n\n @vehicle.on_message('MOUNT_STATUS')\n def listener(vehicle, name, m):\n self._pitch = m.pointing_a / 100.0\n self._roll = m.pointing_b / 100.0\n self._yaw = m.pointing_c / 100.0\n vehicle.notify_attribute_listeners('gimbal', vehicle.gimbal)", "metadata": "root.Gimbal.__init__", "header": "['class', 'Gimbal', '(', 'object', ')', ':', '___EOS___']", "index": 2198 }, { "content": " @property\n def pitch(self):\n \"\"\"\n Gimbal pitch in degrees relative to the vehicle (see diagram for :ref:`attitude <figure_attitude>`).\n A value of 0 represents a camera pointed straight ahead relative to the front of the vehicle,\n while -90 points the camera straight down.\n\n .. note::\n\n This is the last pitch value sent to the gimbal (not the actual/measured pitch).\n \"\"\"\n return self._pitch", "metadata": "root.Gimbal.pitch", "header": "['class', 'Gimbal', '(', 'object', ')', ':', '___EOS___']", "index": 2213 }, { "content": " @property\n def roll(self):\n \"\"\"\n Gimbal roll in degrees relative to the vehicle (see diagram for :ref:`attitude <figure_attitude>`).\n\n .. note::\n\n This is the last roll value sent to the gimbal (not the actual/measured roll).\n \"\"\"\n return self._roll", "metadata": "root.Gimbal.roll", "header": "['class', 'Gimbal', '(', 'object', ')', ':', '___EOS___']", "index": 2226 }, { "content": " @property\n def yaw(self):\n \"\"\"\n Gimbal yaw in degrees relative to *global frame* (0 is North, 90 is West, 180 is South etc).\n\n .. note::\n\n This is the last yaw value sent to the gimbal (not the actual/measured yaw).\n \"\"\"\n return self._yaw", "metadata": "root.Gimbal.yaw", "header": "['class', 'Gimbal', '(', 'object', ')', ':', '___EOS___']", "index": 2237 }, { "content": " def rotate(self, pitch, roll, yaw):\n \"\"\"\n Rotate the gimbal to a specific vector.\n\n .. code-block:: python\n\n #Point the gimbal straight down\n vehicle.gimbal.rotate(-90, 0, 0)\n\n :param pitch: Gimbal pitch in degrees relative to the vehicle (see diagram for :ref:`attitude <figure_attitude>`).\n A value of 0 represents a camera pointed straight ahead relative to the front of the vehicle,\n while -90 points the camera straight down.\n :param roll: Gimbal roll in degrees relative to the vehicle (see diagram for :ref:`attitude <figure_attitude>`).\n :param yaw: Gimbal yaw in degrees relative to *global frame* (0 is North, 90 is West, 180 is South etc.)\n \"\"\"\n msg = self._vehicle.message_factory.mount_configure_encode(\n 0, 1, # target system, target component\n mavutil.mavlink.MAV_MOUNT_MODE_MAVLINK_TARGETING, #mount_mode\n 1, # stabilize roll\n 1, # stabilize pitch\n 1, # stabilize yaw\n )\n self._vehicle.send_mavlink(msg)\n msg = self._vehicle.message_factory.mount_control_encode(\n 0, 1, # target system, target component\n pitch * 100, # pitch is in centidegrees\n roll * 100, # roll\n yaw * 100, # yaw is in centidegrees\n 0) # save position\n self._vehicle.send_mavlink(msg)", "metadata": "root.Gimbal.rotate", "header": "['class', 'Gimbal', '(', 'object', ')', ':', '___EOS___']", "index": 2248 }, { "content": " def target_location(self,roi):\n \"\"\"\n Point the gimbal at a specific region of interest (ROI).\n\n .. code-block:: python\n\n #Set the camera to track the current home location.\n vehicle.gimbal.target_location(vehicle.home_location)\n\n The target position must be defined in a :py:class:`LocationGlobalRelative` or :py:class:`LocationGlobal`.\n\n This function can be called in AUTO or GUIDED mode.\n\n In order to clear an ROI you can send a location with all zeros (e.g. ``LocationGlobalRelative(0,0,0)``).\n\n :param roi: Target location in global relative frame.\n \"\"\"\n #set gimbal to targeting mode\n msg = self._vehicle.message_factory.mount_configure_encode(\n 0, 1, # target system, target component\n mavutil.mavlink.MAV_MOUNT_MODE_GPS_POINT, #mount_mode\n 1, # stabilize roll\n 1, # stabilize pitch\n 1, # stabilize yaw\n )\n self._vehicle.send_mavlink(msg)\n\n #Get altitude relative to home irrespective of Location object passed in.\n if isinstance(roi, LocationGlobalRelative):\n alt = roi.alt\n elif isinstance(roi, LocationGlobal):\n if not self.home_location:\n self.commands.download()\n self.commands.wait_ready()\n alt = roi.alt - self.home_location.alt\n else:\n raise APIException('Expecting location to be LocationGlobal or LocationGlobalRelative.')\n\n #set the ROI\n msg = self._vehicle.message_factory.command_long_encode(\n 0, 1, # target system, target component\n mavutil.mavlink.MAV_CMD_DO_SET_ROI, #command\n 0, #confirmation\n 0, 0, 0, 0, #params 1-4\n roi.lat,\n roi.lon,\n alt\n )\n self._vehicle.send_mavlink(msg)", "metadata": "root.Gimbal.target_location", "header": "['class', 'Gimbal', '(', 'object', ')', ':', '___EOS___']", "index": 2279 }, { "content": " def release(self):\n \"\"\"\n Release control of the gimbal to the user (RC Control).\n\n This should be called once you've finished controlling the mount with either :py:func:`rotate`\n or :py:func:`target_location`. Control will automatically be released if you change vehicle mode.\n \"\"\"\n msg = self._vehicle.message_factory.mount_configure_encode(\n 0, 1, # target system, target component\n mavutil.mavlink.MAV_MOUNT_MODE_RC_TARGETING, #mount_mode\n 1, # stabilize roll\n 1, # stabilize pitch\n 1, # stabilize yaw\n )\n self._vehicle.send_mavlink(msg)", "metadata": "root.Gimbal.release", "header": "['class', 'Gimbal', '(', 'object', ')', ':', '___EOS___']", "index": 2329 }, { "content": " def __str__(self):\n return \"Gimbal: pitch={0}, roll={1}, yaw={2}\".format(self.pitch, self.roll, self.yaw)", "metadata": "root.Gimbal.__str__", "header": "['class', 'Gimbal', '(', 'object', ')', ':', '___EOS___']", "index": 2345 }, { "content": "class Parameters(collections.MutableMapping, HasObservers):\n \"\"\"\n This object is used to get and set the values of named parameters for a vehicle. See the following links for information about\n the supported parameters for each platform: `Copter Parameters <http://copter.ardupilot.com/wiki/configuration/arducopter-parameters/>`_,\n `Plane Parameters <http://plane.ardupilot.com/wiki/arduplane-parameters/>`_, `Rover Parameters <http://rover.ardupilot.com/wiki/apmrover2-parameters/>`_.\n\n The code fragment below shows how to get and set the value of a parameter.\n\n .. code:: python\n\n # Print the value of the THR_MIN parameter.\n print \"Param: %s\" % vehicle.parameters['THR_MIN']\n\n # Change the parameter value to something different.\n vehicle.parameters['THR_MIN']=100\n\n It is also possible to observe parameters and to iterate the :py:attr:`Vehicle.parameters`.\n\n For more information see :ref:`the guide <vehicle_state_parameters>`.\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Parameters", "header": "['module', '___EOS___']", "index": 2349 }, { "content": " def __init__(self, vehicle):\n super(Parameters, self).__init__()\n self._vehicle = vehicle", "metadata": "root.Parameters.__init__", "header": "['class', 'Parameters', '(', 'collections', '.', 'MutableMapping', ',', 'HasObservers', ')', ':', '___EOS___']", "index": 2370 }, { "content": " def __getitem__(self, name):\n name = name.upper()\n self.wait_ready()\n return self._vehicle._params_map[name]", "metadata": "root.Parameters.__getitem__", "header": "['class', 'Parameters', '(', 'collections', '.', 'MutableMapping', ',', 'HasObservers', ')', ':', '___EOS___']", "index": 2374 }, { "content": " def __setitem__(self, name, value):\n name = name.upper()\n self.wait_ready()\n self.set(name, value)", "metadata": "root.Parameters.__setitem__", "header": "['class', 'Parameters', '(', 'collections', '.', 'MutableMapping', ',', 'HasObservers', ')', ':', '___EOS___']", "index": 2379 }, { "content": " def __delitem__(self, name):\n raise APIException('Cannot delete value from parameters list.')", "metadata": "root.Parameters.__delitem__", "header": "['class', 'Parameters', '(', 'collections', '.', 'MutableMapping', ',', 'HasObservers', ')', ':', '___EOS___']", "index": 2384 }, { "content": " def __len__(self):\n return len(self._vehicle._params_map)", "metadata": "root.Parameters.__len__", "header": "['class', 'Parameters', '(', 'collections', '.', 'MutableMapping', ',', 'HasObservers', ')', ':', '___EOS___']", "index": 2387 }, { "content": " def __iter__(self):\n return self._vehicle._params_map.__iter__()", "metadata": "root.Parameters.__iter__", "header": "['class', 'Parameters', '(', 'collections', '.', 'MutableMapping', ',', 'HasObservers', ')', ':', '___EOS___']", "index": 2390 }, { "content": " def get(self, name, wait_ready=True):\n name = name.upper()\n if wait_ready:\n self.wait_ready()\n return self._vehicle._params_map.get(name, None)", "metadata": "root.Parameters.get", "header": "['class', 'Parameters', '(', 'collections', '.', 'MutableMapping', ',', 'HasObservers', ')', ':', '___EOS___']", "index": 2393 }, { "content": " def set(self, name, value, retries=3, wait_ready=False):\n if wait_ready:\n self.wait_ready()\n\n # TODO dumbly reimplement this using timeout loops\n # because we should actually be awaiting an ACK of PARAM_VALUE\n # changed, but we don't have a proper ack structure, we'll\n # instead just wait until the value itself was changed\n\n name = name.upper()\n value = float(value)\n success = False\n remaining = retries\n while True:\n self._vehicle._master.param_set_send(name, value)\n tstart = monotonic.monotonic()\n if remaining == 0:\n break\n remaining -= 1\n while monotonic.monotonic() - tstart < 1:\n if name in self._vehicle._params_map and self._vehicle._params_map[name] == value:\n return True\n time.sleep(0.1)\n\n if retries > 0:\n errprinter(\"timeout setting parameter %s to %f\" % (name, value))\n return False", "metadata": "root.Parameters.set", "header": "['class', 'Parameters', '(', 'collections', '.', 'MutableMapping', ',', 'HasObservers', ')', ':', '___EOS___']", "index": 2399 }, { "content": " def wait_ready(self, **kwargs):\n \"\"\"\n Block the calling thread until parameters have been downloaded\n \"\"\"\n self._vehicle.wait_ready('parameters', **kwargs)", "metadata": "root.Parameters.wait_ready", "header": "['class', 'Parameters', '(', 'collections', '.', 'MutableMapping', ',', 'HasObservers', ')', ':', '___EOS___']", "index": 2427 }, { "content": " def add_attribute_listener(self, attr_name, *args, **kwargs):\n \"\"\"\n Add a listener callback on a particular parameter.\n\n The callback can be removed using :py:func:`remove_attribute_listener`.\n\n .. note::\n\n The :py:func:`on_attribute` decorator performs the same operation as this method, but with\n a more elegant syntax. Use ``add_attribute_listener`` only if you will need to remove\n the observer.\n\n The callback function is invoked only when the parameter changes.\n\n The callback arguments are:\n\n * ``self`` - the associated :py:class:`Parameters`.\n * ``attr_name`` - the parameter name. This can be used to infer which parameter has triggered\n if the same callback is used for watching multiple parameters.\n * ``msg`` - the new parameter value (so you don't need to re-query the vehicle object).\n\n The example below shows how to get callbacks for the ``THR_MIN`` parameter:\n\n .. code:: python\n\n #Callback function for the THR_MIN parameter\n def thr_min_callback(self, attr_name, value):\n print \" PARAMETER CALLBACK: %s changed to: %s\" % (attr_name, value)\n\n #Add observer for the vehicle's THR_MIN parameter\n vehicle.parameters.add_attribute_listener('THR_MIN', thr_min_callback)\n\n See :ref:`vehicle_state_observing_parameters` for more information.\n\n :param String attr_name: The name of the parameter to watch (or '*' to watch all parameters).\n :param args: The callback to invoke when a change in the parameter is detected.\n\n \"\"\"\n attr_name = attr_name.upper()\n return super(Parameters, self).add_attribute_listener(attr_name, *args, **kwargs)", "metadata": "root.Parameters.add_attribute_listener", "header": "['class', 'Parameters', '(', 'collections', '.', 'MutableMapping', ',', 'HasObservers', ')', ':', '___EOS___']", "index": 2433 }, { "content": " def remove_attribute_listener(self, attr_name, *args, **kwargs):\n \"\"\"\n Remove a paremeter listener that was previously added using :py:func:`add_attribute_listener`.\n\n For example to remove the ``thr_min_callback()`` callback function:\n\n .. code:: python\n\n vehicle.parameters.remove_attribute_listener('thr_min', thr_min_callback)\n\n See :ref:`vehicle_state_observing_parameters` for more information.\n\n :param String attr_name: The parameter name that is to have an observer removed (or '*' to remove an 'all attribute' observer).\n :param args: The callback function to remove.\n\n \"\"\"\n attr_name = attr_name.upper()\n return super(Parameters, self).remove_attribute_listener(attr_name, *args, **kwargs)", "metadata": "root.Parameters.remove_attribute_listener", "header": "['class', 'Parameters', '(', 'collections', '.', 'MutableMapping', ',', 'HasObservers', ')', ':', '___EOS___']", "index": 2474 }, { "content": " def notify_attribute_listeners(self, attr_name, *args, **kwargs):\n attr_name = attr_name.upper()\n return super(Parameters, self).notify_attribute_listeners(attr_name, *args, **kwargs)", "metadata": "root.Parameters.notify_attribute_listeners", "header": "['class', 'Parameters', '(', 'collections', '.', 'MutableMapping', ',', 'HasObservers', ')', ':', '___EOS___']", "index": 2493 }, { "content": " def on_attribute(self, attr_name, *args, **kwargs):\n \"\"\"\n Decorator for parameter listeners.\n\n .. note::\n\n There is no way to remove a listener added with this decorator. Use\n :py:func:`add_attribute_listener` if you need to be able to remove\n the :py:func:`listener <remove_attribute_listener>`.\n\n The callback function is invoked only when the parameter changes.\n\n The callback arguments are:\n\n * ``self`` - the associated :py:class:`Parameters`.\n * ``attr_name`` - the parameter name. This can be used to infer which parameter has triggered\n if the same callback is used for watching multiple parameters.\n * ``msg`` - the new parameter value (so you don't need to re-query the vehicle object).\n\n The code fragment below shows how to get callbacks for the ``THR_MIN`` parameter:\n\n .. code:: python\n\n @vehicle.parameters.on_attribute('THR_MIN')\n def decorated_thr_min_callback(self, attr_name, value):\n print \" PARAMETER CALLBACK: %s changed to: %s\" % (attr_name, value)\n\n See :ref:`vehicle_state_observing_parameters` for more information.\n\n :param String attr_name: The name of the parameter to watch (or '*' to watch all parameters).\n :param args: The callback to invoke when a change in the parameter is detected.\n\n \"\"\"\n attr_name = attr_name.upper()\n return super(Parameters, self).on_attribute(attr_name, *args, **kwargs)", "metadata": "root.Parameters.on_attribute", "header": "['class', 'Parameters', '(', 'collections', '.', 'MutableMapping', ',', 'HasObservers', ')', ':', '___EOS___']", "index": 2497 }, { "content": "class Command(mavutil.mavlink.MAVLink_mission_item_message):\n \"\"\"\n A waypoint object.\n\n This object encodes a single mission item command. The set of commands that are supported\n by ArduPilot in Copter, Plane and Rover (along with their parameters) are listed in the wiki article\n `MAVLink Mission Command Messages (MAV_CMD) <http://planner.ardupilot.com/wiki/common-mavlink-mission-command-messages-mav_cmd/>`_.\n\n For example, to create a `NAV_WAYPOINT <http://planner.ardupilot.com/wiki/common-mavlink-mission-command-messages-mav_cmd/#mav_cmd_nav_waypoint>`_ command:\n\n .. code:: python\n\n cmd = Command(0,0,0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT,\n mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 0, 0, 0, 0, 0, 0,-34.364114, 149.166022, 30)\n\n :param target_system: This can be set to any value\n (DroneKit changes the value to the MAVLink ID of the connected vehicle before the command is sent).\n :param target_component: The component id if the message is intended for a particular component within the target system\n (for example, the camera). Set to zero (broadcast) in most cases.\n :param seq: The sequence number within the mission (the autopilot will reject messages sent out of sequence).\n This should be set to zero as the API will automatically set the correct value when uploading a mission.\n :param frame: The frame of reference used for the location parameters (x, y, z). In most cases this will be\n ``mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT``, which uses the WGS84 global coordinate system for latitude and longitude, but sets altitude\n as relative to the home position in metres (home altitude = 0). For more information `see the wiki here\n <http://planner.ardupilot.com/wiki/common-mavlink-mission-command-messages-mav_cmd/#frames_of_reference>`_.\n :param command: The specific mission command (e.g. ``mavutil.mavlink.MAV_CMD_NAV_WAYPOINT``). The supported commands (and command parameters\n are listed `on the wiki <http://planner.ardupilot.com/wiki/common-mavlink-mission-command-messages-mav_cmd/>`_.\n :param current: Set to zero (not supported).\n :param autocontinue: Set to zero (not supported).\n :param param1: Command specific parameter (depends on specific `Mission Command (MAV_CMD) <http://planner.ardupilot.com/wiki/common-mavlink-mission-command-messages-mav_cmd/>`_).\n :param param2: Command specific parameter.\n :param param3: Command specific parameter.\n :param param4: Command specific parameter.\n :param x: (param5) Command specific parameter used for latitude (if relevant to command).\n :param y: (param6) Command specific parameter used for longitude (if relevant to command).\n :param z: (param7) Command specific parameter used for altitude (if relevant). The reference frame for altitude depends on the ``frame``.\n\n \"\"\"\n pass", "metadata": "root.Command", "header": "['module', '___EOS___']", "index": 2534 }, { "content": "class CommandSequence(object):\n \"\"\"\n A sequence of vehicle waypoints (a \"mission\").\n\n Operations include 'array style' indexed access to the various contained waypoints.\n\n The current commands/mission for a vehicle are accessed using the :py:attr:`Vehicle.commands` attribute.\n Waypoints are not downloaded from vehicle until :py:func:`download()` is called. The download is asynchronous;\n use :py:func:`wait_ready()` to block your thread until the download is complete.\n The code to download the commands from a vehicle is shown below:\n\n .. code-block:: python\n :emphasize-lines: 5-10\n\n #Connect to a vehicle object (for example, on com14)\n vehicle = connect('com14', wait_ready=True)\n\n # Download the vehicle waypoints (commands). Wait until download is complete.\n cmds = vehicle.commands\n cmds.download()\n cmds.wait_ready()\n\n The set of commands can be changed and uploaded to the client. The changes are not guaranteed to be complete until\n :py:func:`upload() <Vehicle.commands.upload>` is called.\n\n .. code:: python\n\n cmds = vehicle.commands\n cmds.clear()\n lat = -34.364114,\n lon = 149.166022\n altitude = 30.0\n cmd = Command(0,0,0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_WAYPOINT,\n 0, 0, 0, 0, 0, 0,\n lat, lon, altitude)\n cmds.add(cmd)\n cmds.upload()\n\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.CommandSequence", "header": "['module', '___EOS___']", "index": 2575 }, { "content": " def __init__(self, vehicle):\n self._vehicle = vehicle", "metadata": "root.CommandSequence.__init__", "header": "['class', 'CommandSequence', '(', 'object', ')', ':', '___EOS___']", "index": 2615 }, { "content": " def download(self):\n '''\n Download all waypoints from the vehicle.\n The download is asynchronous. Use :py:func:`wait_ready()` to block your thread until the download is complete.\n '''\n self.wait_ready()\n self._vehicle._ready_attrs.remove('commands')\n self._vehicle._wp_loaded = False\n self._vehicle._master.waypoint_request_list_send()\n # BIG FIXME - wait for full wpt download before allowing any of the accessors to work", "metadata": "root.CommandSequence.download", "header": "['class', 'CommandSequence', '(', 'object', ')', ':', '___EOS___']", "index": 2618 }, { "content": " def wait_ready(self, **kwargs):\n \"\"\"\n Block the calling thread until waypoints have been downloaded.\n\n This can be called after :py:func:`download()` to block the thread until the asynchronous download is complete.\n \"\"\"\n return self._vehicle.wait_ready('commands', **kwargs)", "metadata": "root.CommandSequence.wait_ready", "header": "['class', 'CommandSequence', '(', 'object', ')', ':', '___EOS___']", "index": 2629 }, { "content": " def clear(self):\n '''\n Clear the command list.\n\n This command will be sent to the vehicle only after you call :py:func:`upload() <Vehicle.commands.upload>`.\n '''\n\n # Add home point again.\n self.wait_ready()\n home = None\n try:\n home = self._vehicle._wploader.wp(0)\n except:\n pass\n self._vehicle._wploader.clear()\n if home:\n self._vehicle._wploader.add(home, comment='Added by DroneKit')\n self._vehicle._wpts_dirty = True", "metadata": "root.CommandSequence.clear", "header": "['class', 'CommandSequence', '(', 'object', ')', ':', '___EOS___']", "index": 2637 }, { "content": " def add(self, cmd):\n '''\n Add a new command (waypoint) at the end of the command list.\n\n .. note::\n\n Commands are sent to the vehicle only after you call ::py:func:`upload() <Vehicle.commands.upload>`.\n\n :param Command cmd: The command to be added.\n '''\n self.wait_ready()\n self._vehicle._handler.fix_targets(cmd)\n self._vehicle._wploader.add(cmd, comment='Added by DroneKit')\n self._vehicle._wpts_dirty = True", "metadata": "root.CommandSequence.add", "header": "['class', 'CommandSequence', '(', 'object', ')', ':', '___EOS___']", "index": 2656 }, { "content": " def upload(self):\n \"\"\"\n Call ``upload()`` after :py:func:`adding <CommandSequence.add>` or :py:func:`clearing <CommandSequence.clear>` mission commands.\n\n After the return from ``upload()`` any writes are guaranteed to have completed (or thrown an\n exception) and future reads will see their effects.\n \"\"\"\n if self._vehicle._wpts_dirty:\n self._vehicle._master.waypoint_clear_all_send()\n if self._vehicle._wploader.count() > 0:\n self._vehicle._wp_uploaded = [False] * self._vehicle._wploader.count()\n self._vehicle._master.waypoint_count_send(self._vehicle._wploader.count())\n while False in self._vehicle._wp_uploaded:\n time.sleep(0.1)\n self._vehicle._wp_uploaded = None\n self._vehicle._wpts_dirty = False", "metadata": "root.CommandSequence.upload", "header": "['class', 'CommandSequence', '(', 'object', ')', ':', '___EOS___']", "index": 2671 }, { "content": " @property\n def count(self):\n '''\n Return number of waypoints.\n\n :return: The number of waypoints in the sequence.\n '''\n return max(self._vehicle._wploader.count() - 1, 0)", "metadata": "root.CommandSequence.count", "header": "['class', 'CommandSequence', '(', 'object', ')', ':', '___EOS___']", "index": 2688 }, { "content": " @property\n def next(self):\n \"\"\"\n Get the currently active waypoint number.\n \"\"\"\n return self._vehicle._current_waypoint", "metadata": "root.CommandSequence.next", "header": "['class', 'CommandSequence', '(', 'object', ')', ':', '___EOS___']", "index": 2697 }, { "content": " @next.setter\n def next(self, index):\n \"\"\"\n Set a new ``next`` waypoint for the vehicle.\n \"\"\"\n self._vehicle._master.waypoint_set_current_send(index)", "metadata": "root.CommandSequence.next", "header": "['class', 'CommandSequence', '(', 'object', ')', ':', '___EOS___']", "index": 2704 }, { "content": " def __len__(self):\n '''\n Return number of waypoints.\n\n :return: The number of waypoints in the sequence.\n '''\n return max(self._vehicle._wploader.count() - 1, 0)", "metadata": "root.CommandSequence.__len__", "header": "['class', 'CommandSequence', '(', 'object', ')', ':', '___EOS___']", "index": 2711 }, { "content": " def __getitem__(self, index):\n if isinstance(index, slice):\n return [self[ii] for ii in xrange(*index.indices(len(self)))]\n elif isinstance(index, int):\n item = self._vehicle._wploader.wp(index + 1)\n if not item:\n raise IndexError('Index %s out of range.' % index)\n return item\n else:\n raise TypeError('Invalid argument type.')", "metadata": "root.CommandSequence.__getitem__", "header": "['class', 'CommandSequence', '(', 'object', ')', ':', '___EOS___']", "index": 2719 }, { "content": " def __setitem__(self, index, value):\n self._vehicle._wploader.set(value, index + 1)\n self._vehicle._wpts_dirty = True", "metadata": "root.CommandSequence.__setitem__", "header": "['class', 'CommandSequence', '(', 'object', ')', ':', '___EOS___']", "index": 2730 }, { "content": "def connect(ip,\n _initialize=True,\n wait_ready=None,\n status_printer=errprinter,\n vehicle_class=None,\n rate=4,\n baud=115200,\n heartbeat_timeout=30,\n source_system=255,\n use_native=False):\n \"\"\"\n Returns a :py:class:`Vehicle` object connected to the address specified by string parameter ``ip``.\n Connection string parameters (``ip``) for different targets are listed in the :ref:`getting started guide <get_started_connecting>`.\n\n The method is usually called with ``wait_ready=True`` to ensure that vehicle parameters and (most) attributes are\n available when ``connect()`` returns.\n\n .. code:: python\n\n from dronekit import connect\n\n # Connect to the Vehicle using \"connection string\" (in this case an address on network)\n vehicle = connect('127.0.0.1:14550', wait_ready=True)\n\n :param String ip: :ref:`Connection string <get_started_connecting>` for target address - e.g. 127.0.0.1:14550.\n\n :param Bool/Array wait_ready: If ``True`` wait until all default attributes have downloaded before\n the method returns (default is ``None``).\n The default attributes to wait on are: :py:attr:`parameters`, :py:attr:`gps_0`,\n :py:attr:`armed`, :py:attr:`mode`, and :py:attr:`attitude`.\n\n You can also specify a named set of parameters to wait on (e.g. ``wait_ready=['system_status','mode']``).\n\n For more information see :py:func:`Vehicle.wait_ready <Vehicle.wait_ready>`.\n\n :param status_printer: Method of signature ``def status_printer(txt)`` that prints\n STATUS_TEXT messages from the Vehicle and other diagnostic information.\n By default the status information is printed to the command prompt in which the script is running.\n :param Vehicle vehicle_class: The class that will be instantiated by the ``connect()`` method.\n This can be any sub-class of ``Vehicle`` (and defaults to ``Vehicle``).\n :param int rate: Data stream refresh rate. The default is 4Hz (4 updates per second).\n :param int baud: The baud rate for the connection. The default is 115200.\n :param int heartbeat_timeout: Connection timeout value in seconds (default is 30s).\n If a heartbeat is not detected within this time an exception will be raised.\n :param int source_system: The MAVLink ID of the :py:class:`Vehicle` object returned by this method (by default 255).\n :param bool use_native: Use precompiled MAVLink parser.\n\n .. note::\n\n The returned :py:class:`Vehicle` object acts as a ground control station from the\n perspective of the connected \"real\" vehicle. It will process/receive messages from the real vehicle\n if they are addressed to this ``source_system`` id. Messages sent to the real vehicle are\n automatically updated to use the vehicle's ``target_system`` id.\n\n It is *good practice* to assign a unique id for every system on the MAVLink network.\n It is possible to configure the autopilot to only respond to guided-mode commands from a specified GCS ID.\n\n\n :returns: A connected vehicle of the type defined in ``vehicle_class`` (a superclass of :py:class:`Vehicle`).\n \"\"\"\n\n if not vehicle_class:\n vehicle_class = Vehicle\n\n handler = MAVConnection(ip, baud=baud, source_system=source_system, use_native=use_native)\n vehicle = vehicle_class(handler)\n\n if status_printer:\n\n @vehicle.on_message('STATUSTEXT')\n def listener(self, name, m):\n status_printer(re.sub(r'(^|\\n)', '>>> ', m.text.rstrip()))\n\n if _initialize:\n vehicle.initialize(rate=rate, heartbeat_timeout=heartbeat_timeout)\n\n if wait_ready:\n if wait_ready == True:\n vehicle.wait_ready(True)\n else:\n vehicle.wait_ready(*wait_ready)\n\n return vehicle", "metadata": "root.connect", "header": "['module', '___EOS___']", "index": 2738 } ]
[ { "span": "import socket", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 13 }, { "span": "import sys", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 10 }, { "span": "import os", "start_line": 37, "start_column": 0, "end_line": 37, "end_column": 9 }, { "span": "import platform", "start_line": 38, "start_column": 0, "end_line": 38, "end_column": 15 }, { "span": "from Queue import Queue, Empty", "start_line": 42, "start_column": 0, "end_line": 42, "end_column": 30 }, { "span": "from threading import Thread", "start_line": 43, "start_column": 0, "end_line": 43, "end_column": 28 }, { "span": "import types", "start_line": 44, "start_column": 0, "end_line": 44, "end_column": 12 }, { "span": "import threading", "start_line": 45, "start_column": 0, "end_line": 45, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Dro", "ne", "API", " ", "module_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", " ", "is", " ", "the", " ", "API", " ", "Reference", " ", "for", " ", "the", " ", "Dro", "ne", "Kit", "-", "Pyth", "on", " ", "API", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "main", " ", "API", " ", "is", " ", "the", " ", ":", "py", ":", "class", ":`", "Vehicle", "`", " ", "class", ".", "\\", "10", ";", "The", " ", "code", " ", "snippet", " ", "belo", "w", " ", "show", "s", " ", "how", " ", "to", " ", "use", " ", ":", "py", ":", "func", ":`", "connect", "`", " ", "to", " ", "obtain", " ", "an", " ", "instance", " ", "of", " ", "a", " ", "connect", "ed", " ", "vehic", "le", ":", "\\", "10", ";", "\\", "10", ";", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "drone", "kit", " ", "import", " ", "connect", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Connect", " ", "to", " ", "the", " ", "Vehicle", " ", "usi", "ng", " ", "\"", "connecti", "on", " ", "string", "\"", " ", "(", "in", " ", "this", " ", "case", " ", "an", " ", "address", " ", "on", " ", "network", ")", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", " ", "=", " ", "connect", "('", "127", ".0", ".0", ".1", ":", "145", "50", "',", " ", "wait", "\\u", "read", "y", "=", "Tru", "e", ")", "\\", "10", ";", "\\", "10", ";", ":", "py", ":", "class", ":`", "Vehicle", "`", " ", "provide", "s", " ", "access", " ", "to", " ", "vehic", "le", " ", "*", "state", "*", " ", "through", " ", "python", " ", "attribute", "s", "\\", "10", ";", "(", "e", ".", "g", ".", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "mode", "`)", "\\", "10", ";", "and", " ", "to", " ", "settings", "/", "parameter", "s", " ", "tho", "ugh", " ", "the", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "parameter", "s", "`", " ", "attribute", ".", "\\", "10", ";", "Async", "hronous", " ", "notification", " ", "on", " ", "vehic", "le", " ", "attribute", " ", "change", "s", " ", "is", " ", "avail", "able", " ", "by", " ", "register", "ing", " ", "listeners", "/", "observer", "s", ".", "\\", "10", ";", "\\", "10", ";", "Vehicle", " ", "movement", " ", "is", " ", "prima", "ri", "ly", " ", "controlle", "d", " ", "usi", "ng", " ", "the", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "arme", "d", "`", " ", "attribute", " ", "and", "\\", "10", ";", ":", "py", ":", "func", ":`", "Vehicle", ".", "simple", "\\u", "take", "off", "`", " ", "and", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "simple", "\\u", "got", "o", "`", " ", "in", " ", "GUID", "ED", " ", "mode", ".", "\\", "10", ";", "\\", "10", ";", "Velocity", "-", "based", " ", "movement", " ", "and", " ", "control", " ", "over", " ", "other", " ", "vehic", "le", " ", "features", " ", "can", " ", "be", " ", "achieve", "d", " ", "usi", "ng", " ", "custom", " ", "MAV", "Link", " ", "message", "s", "\\", "10", ";", "(:", "py", ":", "func", ":`", "Vehicle", ".", "send", "\\u", "mavlink", "`", ",", " ", ":", "py", ":", "func", ":`", "Vehicle", ".", "message", "\\u", "factor", "y", "`)", ".", "\\", "10", ";", "\\", "10", ";", "It", " ", "is", " ", "als", "o", " ", "possib", "le", " ", "to", " ", "work", " ", "with", " ", "vehic", "le", " ", "\"", "missio", "ns", "\"", " ", "usi", "ng", " ", "the", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "command", "s", "`", " ", "attribute", ",", " ", "and", " ", "run", " ", "them", " ", "in", " ", "AUTO", " ", "mode", ".", "\\", "10", ";", "\\", "10", ";", "A", " ", "number", " ", "of", " ", "other", " ", "usef", "ul", " ", "classe", "s", " ", "and", " ", "method", "s", " ", "are", " ", "liste", "d", " ", "belo", "w", ".", "\\", "10", ";", "\\", "10", ";", "----", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "monotonic", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "drone", "kit_", "._", "util_", "import_", "err", "printer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyma", "vlin", "k_", "import_", "mav", "util_", ",_", "mav", "wp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Queue_", "import_", "Queue_", ",_", "Empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "threading_", "import_", "Thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyma", "vlin", "k_", "._", "dialect", "s_", "._", "v1", "0_", "import_", "ard", "upi", "lot", "mega", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "drone", "kit_", "._", "mavlink", "_", "import_", "MAV", "Connection_", "\\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_", "API", "Exception_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "class", " ", "for", " ", "Dro", "ne", "Kit", " ", "relate", "d", " ", "exception", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "String", " ", "message", ":", " ", "Messag", "e", " ", "string", " ", "descri", "bing", " ", "the", " ", "exception", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "API", "Exception_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "API", "Exception_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Att", "itude_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Att", "itu", "de", " ", "informati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "object", " ", "of", " ", "this", " ", "type", " ", "is", " ", "return", "ed", " ", "by", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "atti", "tude", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "\\u", "figure", "\\u", "atti", "tude", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "figure", "::", " ", "http", "://", "upload", ".", "wiki", "media", ".", "org", "/", "wikip", "edia", "/", "common", "s", "/", "thumb", "/", "c", "/", "c1", "/", "Ya", "w", "\\u", "Axi", "s", "\\u", "Correct", "ed", ".", "svg", "/", "500", "px", "-", "Ya", "w", "\\u", "Axi", "s", "\\u", "Correct", "ed", ".", "svg", ".", "png", "\\", "10", ";", " ", " ", " ", " ", ":", "widt", "h", ":", " ", "400", "px", "\\", "10", ";", " ", " ", " ", " ", ":", "alt", ":", " ", "Diagram", " ", "showin", "g", " ", "Pit", "ch", ",", " ", "Roll", ",", " ", "Ya", "w", "\\", "10", ";", " ", " ", " ", " ", ":", "target", ":", " ", "http", "://", "common", "s", ".", "wiki", "media", ".", "org", "/", "wiki", "/", "File", ":", "Ya", "w", "\\u", "Axi", "s", "\\u", "Correct", "ed", ".", "svg", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Diagram", " ", "showin", "g", " ", "Pit", "ch", ",", " ", "Roll", ",", " ", "Ya", "w", " ", "(", "`", "Creative", " ", "Common", "s", " ", "<", "http", "://", "common", "s", ".", "wiki", "media", ".", "org", "/", "wiki", "/", "File", ":", "Ya", "w", "\\u", "Axi", "s", "\\u", "Correct", "ed", ".", "svg", ">`\\u", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "pitch", ":", " ", "Pit", "ch", " ", "in", " ", "radian", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "yaw", ":", " ", "Ya", "w", " ", "in", " ", "radian", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "roll", ":", " ", "Roll", " ", "in", " ", "radian", "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_", "[SEP]_", "class_", "Att", "itude_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "pitch_", ",_", "yaw_", ",_", "roll_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pitch_", "=_", "pitch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "yaw_", "=_", "yaw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "roll_", "=_", "roll_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Att", "itude_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Att", "itu", "de", ":", "pitch", "=", "%", "s", ",", "yaw", "=", "%", "s", ",", "roll", "=", "%", "s", "\"_", "%_", "(_", "self_", "._", "pitch_", ",_", "self_", "._", "yaw_", ",_", "self_", "._", "roll_", ")_", "\\u\\u\\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_", "Locat", "ion", "Global_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "global", " ", "location", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "latitude", " ", "and", " ", "longitude", " ", "are", " ", "relative", " ", "to", " ", "the", " ", "`", "WG", "S", "84", " ", "coordinate", " ", "system", " ", "<", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "Wor", "ld", "\\u", "Geo", "det", "ic", "\\u", "System", ">`\\u", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "alti", "tude", " ", "is", " ", "relative", " ", "to", " ", "mean", " ", "sea", "-", "level", " ", "(", "MS", "L", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "a", " ", "global", " ", "location", " ", "object", " ", "with", " ", "alti", "tude", " ", "30", " ", "metre", "s", " ", "above", " ", "sea", " ", "level", " ", "mig", "ht", " ", "be", " ", "defin", "ed", " ", "as", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "Locat", "ion", "Global", "(-", "34.", "364", "114", ",", " ", "149", ".1", "660", "2", "2", ",", " ", "30", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "todo", "::", " ", "FIX", "ME", ":", " ", "Locat", "ion", " ", "class", " ", "-", " ", "possib", "ly", " ", "add", " ", "a", " ", "vector", "3", " ", "represent", "ation", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "object", " ", "of", " ", "this", " ", "type", " ", "is", " ", "owned", " ", "by", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "location", "`.", " ", "See", " ", "tha", "t", " ", "class", " ", "for", " ", "informati", "on", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "readi", "ng", " ", "and", " ", "obs", "ervi", "ng", " ", "location", " ", "in", " ", "the", " ", "global", " ", "frame", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "lat", ":", " ", "Lat", "itu", "de", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "lon", ":", " ", "Long", "itu", "de", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "alt", ":", " ", "Alt", "itu", "de", " ", "in", " ", "mete", "rs", " ", "relative", " ", "to", " ", "mean", " ", "sea", "-", "level", " ", "(", "MS", "L", ").", "\\", "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_", "Locat", "ion", "Global_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lat_", ",_", "lon_", ",_", "alt_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lat_", "=_", "lat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lon_", "=_", "lon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "alt_", "=_", "alt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "for", " ", "back", "ward", " ", "compatibility", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "local", "\\u", "frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "global", "\\u", "frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Locat", "ion", "Global_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Locat", "ion", "Global", ":", "lat", "=", "%", "s", ",", "lon", "=", "%", "s", ",", "alt", "=", "%", "s", "\"_", "%_", "(_", "self_", "._", "lat_", ",_", "self_", "._", "lon_", ",_", "self_", "._", "alt_", ")_", "\\u\\u\\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_", "Locat", "ion", "Global", "Relative", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "global", " ", "location", " ", "object", ",", " ", "with", " ", "atti", "tude", " ", "relative", " ", "to", " ", "home", " ", "location", " ", "alti", "tude", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "latitude", " ", "and", " ", "longitude", " ", "are", " ", "relative", " ", "to", " ", "the", " ", "`", "WG", "S", "84", " ", "coordinate", " ", "system", " ", "<", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "Wor", "ld", "\\u", "Geo", "det", "ic", "\\u", "System", ">`\\u", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "alti", "tude", " ", "is", " ", "relative", " ", "to", " ", "the", " ", "*", "home", " ", "position", "*.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "a", " ", "``", "Locat", "ion", "Global", "Relative", "``", " ", "object", " ", "with", " ", "an", " ", "alti", "tude", " ", "of", " ", "30", " ", "metre", "s", " ", "above", " ", "the", " ", "home", " ", "location", " ", "mig", "ht", " ", "be", " ", "defin", "ed", " ", "as", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "Locat", "ion", "Global", "Relative", "(-", "34.", "364", "114", ",", " ", "149", ".1", "660", "2", "2", ",", " ", "30", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "todo", "::", " ", "FIX", "ME", ":", " ", "Locat", "ion", " ", "class", " ", "-", " ", "possib", "ly", " ", "add", " ", "a", " ", "vector", "3", " ", "represent", "ation", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "object", " ", "of", " ", "this", " ", "type", " ", "is", " ", "owned", " ", "by", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "location", "`.", " ", "See", " ", "tha", "t", " ", "class", " ", "for", " ", "informati", "on", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "readi", "ng", " ", "and", " ", "obs", "ervi", "ng", " ", "location", " ", "in", " ", "the", " ", "global", "-", "relative", " ", "frame", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "lat", ":", " ", "Lat", "itu", "de", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "lon", ":", " ", "Long", "itu", "de", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "alt", ":", " ", "Alt", "itu", "de", " ", "in", " ", "mete", "rs", " ", "(", "relative", " ", "to", " ", "the", " ", "home", " ", "location", ").", "\\", "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_", "Locat", "ion", "Global", "Relative", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lat_", ",_", "lon_", ",_", "alt_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lat_", "=_", "lat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lon_", "=_", "lon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "alt_", "=_", "alt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "for", " ", "back", "ward", " ", "compatibility", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "local", "\\u", "frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "global", "\\u", "frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Locat", "ion", "Global", "Relative", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Locat", "ion", "Global", "Relative", ":", "lat", "=", "%", "s", ",", "lon", "=", "%", "s", ",", "alt", "=", "%", "s", "\"_", "%_", "(_", "self_", "._", "lat_", ",_", "self_", "._", "lon_", ",_", "self_", "._", "alt_", ")_", "\\u\\u\\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_", "Locat", "ion", "Local_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "local", " ", "location", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "north", ",", " ", "east", " ", "and", " ", "down", " ", "are", " ", "relative", " ", "to", " ", "the", " ", "EK", "F", " ", "orig", "in", ".", " ", " ", "Thi", "s", " ", "is", " ", "most", " ", "like", "ly", " ", "the", " ", "location", " ", "where", " ", "the", " ", "vehic", "le", " ", "was", " ", "turn", "ed", " ", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "object", " ", "of", " ", "this", " ", "type", " ", "is", " ", "owned", " ", "by", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "location", "`.", " ", "See", " ", "tha", "t", " ", "class", " ", "for", " ", "informati", "on", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "readi", "ng", " ", "and", " ", "obs", "ervi", "ng", " ", "location", " ", "in", " ", "the", " ", "local", " ", "frame", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "north", ":", " ", "Position", " ", "north", " ", "of", " ", "the", " ", "EK", "F", " ", "orig", "in", " ", "in", " ", "mete", "rs", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "east", ":", " ", "Position", " ", "east", " ", "of", " ", "the", " ", "EK", "F", " ", "orig", "in", " ", "in", " ", "mete", "rs", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "down", ":", " ", "Position", " ", "down", " ", "from", " ", "the", " ", "EK", "F", " ", "orig", "in", " ", "in", " ", "mete", "rs", ".", " ", "(", "i", ".", "e", ".", " ", "negati", "ve", " ", "alti", "tude", " ", "in", " ", "mete", "rs", ")", "\\", "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_", "Locat", "ion", "Local_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "north_", ",_", "east_", ",_", "down_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "north_", "=_", "north_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "east_", "=_", "east_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "down_", "=_", "down_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Locat", "ion", "Local_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Locat", "ion", "Local", ":", "north", "=", "%", "s", ",", "east", "=", "%", "s", ",", "down", "=", "%", "s", "\"_", "%_", "(_", "self_", "._", "north_", ",_", "self_", "._", "east_", ",_", "self_", "._", "down_", ")_", "\\u\\u\\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_", "GPS", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Standard", " ", "informati", "on", " ", "abo", "ut", " ", "GPS", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "there", " ", "is", " ", "no", " ", "GPS", " ", "lock", " ", "the", " ", "parameter", "s", " ", "are", " ", "set", " ", "to", " ", "``", "Non", "e", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "Int", " ", "eph", ":", " ", "GPS", " ", "horizon", "tal", " ", "dil", "uti", "on", " ", "of", " ", "position", " ", "(", "HD", "OP", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "Int", " ", "ep", "v", ":", " ", "GPS", " ", "vertical", " ", "dil", "uti", "on", " ", "of", " ", "position", " ", "(", "VD", "OP", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "Int", " ", "fix", "\\u", "type", ":", " ", "0", "-1", ":", " ", "no", " ", "fix", ",", " ", "2", ":", " ", "2", "D", " ", "fix", ",", " ", "3", ":", " ", "3", "D", " ", "fix", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "Int", " ", "satellite", "s", "\\u", "visi", "ble", ":", " ", "Number", " ", "of", " ", "satellite", "s", " ", "visi", "ble", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "todo", "::", " ", "FIX", "ME", ":", " ", "GPS", "Info", " ", "class", " ", "-", " ", "possib", "ly", " ", "normali", "ze", " ", "eph", "/", "ep", "v", "?", " ", " ", "report", " ", "fix", " ", "type", " ", "as", " ", "string", "?", "\\", "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_", "GPS", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "eph", "_", ",_", "ep", "v_", ",_", "fix", "\\u", "type_", ",_", "satellite", "s", "\\u", "visible_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "eph", "_", "=_", "eph", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ep", "v_", "=_", "ep", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fix", "\\u", "type_", "=_", "fix", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "satellite", "s", "\\u", "visible_", "=_", "satellite", "s", "\\u", "visible_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GPS", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "GPS", "Info", ":", "fix", "=", "%", "s", ",", "num", "\\u", "sat", "=", "%", "s", "\"_", "%_", "(_", "self_", "._", "fix", "\\u", "type_", ",_", "self_", "._", "satellite", "s", "\\u", "visible_", ")_", "\\u\\u\\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_", "Batt", "ery", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "System", " ", "battery", " ", "informati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "object", " ", "of", " ", "this", " ", "type", " ", "is", " ", "return", "ed", " ", "by", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "battery", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "voltage", ":", " ", "Batt", "ery", " ", "voltage", " ", "in", " ", "milli", "volt", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "current", ":", " ", "Batt", "ery", " ", "current", ",", " ", "in", " ", "10", " ", "*", " ", "milli", "amp", "eres", ".", " ", "``", "Non", "e", "``", " ", "if", " ", "the", " ", "autop", "ilo", "t", " ", "doe", "s", " ", "not", " ", "support", " ", "current", " ", "measure", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "level", ":", " ", "Rema", "inin", "g", " ", "battery", " ", "energ", "y", ".", " ", "``", "Non", "e", "``", " ", "if", " ", "the", " ", "autop", "ilo", "t", " ", "cann", "ot", " ", "estimate", " ", "the", " ", "rema", "inin", "g", " ", "battery", ".", "\\", "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_", "Batt", "ery", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "voltage_", ",_", "current_", ",_", "level_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "voltage_", "=_", "voltage_", "/_", "1000.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "current_", "=_", "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_", "._", "current_", "=_", "current_", "/_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "level_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "level_", "=_", "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_", "._", "level_", "=_", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Batt", "ery", "_", "(_", "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", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Batt", "ery", ":", "voltage", "={}", ",", "current", "={}", ",", "level", "={}\"_", "._", "format_", "(_", "self_", "._", "voltage_", ",_", "self_", "._", "current_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "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_", "Range", "finder_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Range", "finde", "r", " ", "readings", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "object", " ", "of", " ", "this", " ", "type", " ", "is", " ", "return", "ed", " ", "by", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "range", "finde", "r", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "distance", ":", " ", "Distan", "ce", " ", "(", "metre", "s", ").", " ", "``", "Non", "e", "``", " ", "if", " ", "the", " ", "vehic", "le", " ", "doe", "sn", "'", "t", " ", "have", " ", "a", " ", "range", "finde", "r", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "voltage", ":", " ", "Volt", "age", " ", "(", "volt", "s", ").", " ", "``", "Non", "e", "``", " ", "if", " ", "the", " ", "vehic", "le", " ", "doe", "sn", "'", "t", " ", "have", " ", "a", " ", "range", "finde", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Range", "finder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "distance_", ",_", "voltage_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "distance_", "=_", "distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "voltage_", "=_", "voltage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Range", "finder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Range", "finde", "r", ":", " ", "distance", "={}", ",", " ", "voltage", "={}\"_", "._", "format_", "(_", "self_", "._", "distance_", ",_", "self_", "._", "voltage_", ")_", "\\u\\u\\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_", "Version_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Auto", "pilot", " ", "version", " ", "and", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "object", " ", "of", " ", "this", " ", "type", " ", "is", " ", "return", "ed", " ", "by", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "version", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "version", " ", "number", " ", "can", " ", "be", " ", "read", " ", "in", " ", "a", " ", "few", " ", "different", " ", "formats", ".", " ", "To", " ", "get", " ", "it", " ", "in", " ", "a", " ", "human", "-", "reada", "ble", "\\", "10", ";", " ", " ", " ", " ", "format", ",", " ", "just", " ", "print", " ", "`", "vehic", "le", ".", "version", "`.", " ", " ", "Thi", "s", " ", "mig", "ht", " ", "print", " ", "somet", "hing", " ", "like", " ", "\"", "AP", "M", ":", "Cop", "ter", "-", "3.3", ".2", "-", "rc", "4", "\".\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "2.0", ".3", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "major", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Maj", "or", " ", "version", " ", "number", " ", "(", "integ", "er", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", "mino", "r", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Min", "or", " ", "version", " ", "number", " ", "(", "integ", "er", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "patch", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Pat", "ch", " ", "version", " ", "number", " ", "(", "integ", "er", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "release", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Release", " ", "type", " ", "(", "integ", "er", ").", " ", "See", " ", "the", " ", "enum", " ", "`", "FIR", "MW", "ARE", "\\u", "VERSI", "ON", "\\u", "TYPE", " ", "<", "http", "://", "mavlink", ".", "org", "/", "message", "s", "/", "common", "#", "http", "://", "mavlink", ".", "org", "/", "message", "s", "/", "common", "#", "FIR", "MW", "ARE", "\\u", "VERSI", "ON", "\\u", "TYPE", "\\u", "DEV", ">`\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "composi", "te", " ", "of", " ", "the", " ", "product", " ", "release", " ", "cycle", " ", "stage", " ", "(", "rc", ",", " ", "beta", " ", "etc", ")", " ", "and", " ", "the", " ", "version", " ", "in", " ", "tha", "t", " ", "cycle", " ", "-", " ", "e", ".", "g", ".", " ", "23.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Version_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "raw", "\\u", "version_", ",_", "autop", "ilo", "t", "\\u", "type_", ",_", "vehic", "le", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "autop", "ilo", "t", "\\u", "type_", "=_", "autop", "ilo", "t", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vehic", "le", "\\u", "type_", "=_", "vehic", "le", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "raw", "\\u", "version_", "=_", "raw", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "raw", "\\u", "version_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "major_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "minor_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "patch_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "release_", "=_", "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_", "._", "major_", "=_", "raw", "\\u", "version_", ">>_", "24_", "&_", "0xFF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "minor_", "=_", "raw", "\\u", "version_", ">>_", "16_", "&_", "0xFF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "patch_", "=_", "raw", "\\u", "version_", ">>_", "8_", "&_", "0xFF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "release_", "=_", "raw", "\\u", "version_", "&_", "0xFF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Version_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "stable_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "the", " ", "autop", "ilo", "t", " ", "report", "s", " ", "tha", "t", " ", "the", " ", "current", " ", "firmware", " ", "is", " ", "a", " ", "stable", "\\", "10", ";", " ", " ", " ", " ", "release", " ", "(", "not", " ", "a", " ", "pre", "-", "release", " ", "or", " ", "develop", "ment", " ", "version", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "release_", "==_", "255_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Version_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "release", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "version", " ", "within", " ", "the", " ", "release", " ", "type", " ", "(", "an", " ", "integ", "er", ").", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "return", "s", " ", "\"", "23", "\"", " ", "for", " ", "Cop", "ter", "-", "3.3", "rc", "23.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "release_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "release_", "==_", "255_", ")_", ":_", "\\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_", "return_", "self_", "._", "release_", "%_", "64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Version_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "release", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "text", " ", "descri", "bing", " ", "the", " ", "release", " ", "type", " ", "e", ".", "g", ".", " ", "\"", "alpha", "\",", " ", "\"", "stable", "\"", " ", "etc", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "release_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "types_", "=_", "[_", "\"", "dev", "\"_", ",_", "\"", "alpha", "\"_", ",_", "\"", "beta", "\"_", ",_", "\"", "rc", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "types_", "[_", "self_", "._", "release_", "/_", "64_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Version_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "self_", "._", "autop", "ilo", "t", "\\u", "type_", "==_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "AUTO", "PI", "LOT", "\\u", "ARD", "UP", "ILO", "TM", "EGA", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "+=_", "\"", "AP", "M", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "self_", "._", "autop", "ilo", "t", "\\u", "type_", "==_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "AUTO", "PI", "LOT", "\\u", "PX", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "+=_", "\"", "PX", "4", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "+=_", "\"", "Un", "know", "n", "Auto", "Pilo", "t", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "vehic", "le", "\\u", "type_", "==_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "TYPE", "\\u", "QUA", "DR", "OT", "OR_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "+=_", "\"", "Cop", "ter", "-\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "self_", "._", "vehic", "le", "\\u", "type_", "==_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "TYPE", "\\u", "FIXED", "\\u", "WIN", "G_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "+=_", "\"", "Plan", "e-", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "self_", "._", "vehic", "le", "\\u", "type_", "==_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "TYPE", "\\u", "GROU", "ND", "\\u", "RO", "VER_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "+=_", "\"", "Ro", "ver", "-\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "+=_", "\"", "Un", "know", "n", "Vehicle", "Type", "%", "d", "-\"_", "%_", "(_", "self_", "._", "vehic", "le", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "release", "\\u", "type_", "(_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release", "\\u", "type_", "=_", "\"", "Un", "know", "n", "Release", "Type", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "is", "\\u", "stable_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release", "\\u", "type_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "e", ".", "g", ".", " ", "\"-", "rc", "23", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release", "\\u", "type_", "=_", "\"-\"_", "+_", "str_", "(_", "self_", "._", "release", "\\u", "type_", "(_", ")_", ")_", "+_", "str_", "(_", "self_", "._", "release", "\\u", "version_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "prefix_", "+_", "\"%", "s", ".", "%", "s", ".", "%", "s", "\"_", "%_", "(_", "self_", "._", "major_", ",_", "self_", "._", "minor_", ",_", "self_", "._", "patch_", ")_", "+_", "release", "\\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_", "Capabilities", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Auto", "pilot", " ", "capab", "ilities", " ", "(", "support", "ed", " ", "message", " ", "types", " ", "and", " ", "functional", "it", "y", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "object", " ", "of", " ", "this", " ", "type", " ", "is", " ", "return", "ed", " ", "by", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "capab", "ilities", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "the", " ", "enum", "\\", "10", ";", " ", " ", " ", " ", "`", "MAV", "\\u", "PROTOCOL", "\\u", "CAPA", "BILITY", " ", "<", "http", "://", "mavlink", ".", "org", "/", "message", "s", "/", "common", "#", "MAV", "\\u", "PROTOCOL", "\\u", "CAPA", "BILITY", "\\u", "MISSI", "ON", "\\u", "FLOAT", ">`\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "2.0", ".3", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "missio", "n", "\\u", "float", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Auto", "pilot", " ", "support", "s", " ", "MISSI", "ON", " ", "float", " ", "message", " ", "type", " ", "(", "Boo", "lean", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "param", "\\u", "float", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Auto", "pilot", " ", "support", "s", " ", "the", " ", "PARAM", " ", "float", " ", "message", " ", "type", " ", "(", "Boo", "lean", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "missio", "n", "\\u", "int", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Auto", "pilot", " ", "support", "s", " ", "MISSI", "ON", "\\u", "INT", " ", "scale", "d", " ", "integ", "er", " ", "message", " ", "type", " ", "(", "Boo", "lean", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "command", "\\u", "int", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Auto", "pilot", " ", "support", "s", " ", "COMMA", "ND", "\\u", "INT", " ", "scale", "d", " ", "integ", "er", " ", "message", " ", "type", " ", "(", "Boo", "lean", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "param", "\\u", "uni", "on", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Auto", "pilot", " ", "support", "s", " ", "the", " ", "PARAM", "\\u", "UNION", " ", "message", " ", "type", " ", "(", "Boo", "lean", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "ftp", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Auto", "pilot", " ", "support", "s", " ", "ftp", " ", "for", " ", "file", " ", "transfers", " ", "(", "Boo", "lean", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "set\\u", "atti", "tude", "\\u", "target", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Auto", "pilot", " ", "support", "s", " ", "command", "ing", " ", "atti", "tude", " ", "off", "board", " ", "(", "Boo", "lean", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "set\\u", "atti", "tude", "\\u", "target", "\\u", "local", "\\u", "ned", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Auto", "pilot", " ", "support", "s", " ", "command", "ing", " ", "position", " ", "and", " ", "velo", "city", " ", "target", "s", " ", "in", " ", "local", " ", "NED", " ", "frame", " ", "(", "Boo", "lean", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "set\\u", "alti", "tude", "\\u", "target", "\\u", "global", "\\u", "int", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Auto", "pilot", " ", "support", "s", " ", "command", "ing", " ", "position", " ", "and", " ", "velo", "city", " ", "target", "s", " ", "in", " ", "global", " ", "scale", "d", " ", "integ", "ers", " ", "(", "Boo", "lean", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "terrain", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Auto", "pilot", " ", "support", "s", " ", "terrain", " ", "protoc", "ol", " ", "/", " ", "data", " ", "handling", " ", "(", "Boo", "lean", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "set\\u", "actuator", "\\u", "target", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Auto", "pilot", " ", "support", "s", " ", "direct", " ", "actuator", " ", "control", " ", "(", "Boo", "lean", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "flight", "\\u", "termination", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Auto", "pilot", " ", "support", "s", " ", "the", " ", "flight", " ", "termination", " ", "command", " ", "(", "Boo", "lean", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "compass", "\\u", "calibra", "tion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Auto", "pilot", " ", "support", "s", " ", "onbo", "ard", " ", "compass", " ", "calibra", "tion", " ", "(", "Boo", "lean", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Capabilities", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "capabilities_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "missio", "n", "\\u", "float_", "=_", "(_", "(_", "(_", "capabilities_", ">>_", "0_", ")_", "&_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "float_", "=_", "(_", "(_", "(_", "capabilities_", ">>_", "1_", ")_", "&_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "missio", "n", "\\u", "int_", "=_", "(_", "(_", "(_", "capabilities_", ">>_", "2_", ")_", "&_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "command", "\\u", "int_", "=_", "(_", "(_", "(_", "capabilities_", ">>_", "3_", ")_", "&_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "param", "\\u", "union_", "=_", "(_", "(_", "(_", "capabilities_", ">>_", "4_", ")_", "&_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ftp_", "=_", "(_", "(_", "(_", "capabilities_", ">>_", "5_", ")_", "&_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "atti", "tude", "\\u", "target_", "=_", "(_", "(_", "(_", "capabilities_", ">>_", "6_", ")_", "&_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "atti", "tude", "\\u", "target", "\\u", "local", "\\u", "ned", "_", "=_", "(_", "(_", "(_", "capabilities_", ">>_", "7_", ")_", "&_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "alti", "tude", "\\u", "target", "\\u", "global", "\\u", "int_", "=_", "(_", "(_", "(_", "capabilities_", ">>_", "8_", ")_", "&_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "terrain", "_", "=_", "(_", "(_", "(_", "capabilities_", ">>_", "9_", ")_", "&_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "actuator", "\\u", "target_", "=_", "(_", "(_", "(_", "capabilities_", ">>_", "10_", ")_", "&_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "flight", "\\u", "termination", "_", "=_", "(_", "(_", "(_", "capabilities_", ">>_", "11_", ")_", "&_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "compass", "\\u", "calibration_", "=_", "(_", "(_", "(_", "capabilities_", ">>_", "12_", ")_", "&_", "1_", ")_", "==_", "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_", "Vehicle", "Mode_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "object", " ", "is", " ", "used", " ", "to", " ", "get", " ", "and", " ", "set", " ", "the", " ", "current", " ", "\"", "flight", " ", "mode", "\".\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "flight", " ", "mode", " ", "dete", "rmin", "es", " ", "the", " ", "behaviour", " ", "of", " ", "the", " ", "vehic", "le", " ", "and", " ", "what", " ", "command", "s", " ", "it", " ", "can", " ", "obe", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "recommende", "d", " ", "flight", " ", "mode", "s", " ", "for", " ", "*", "Dro", "ne", "Kit", "-", "Pyth", "on", "*", " ", "apps", " ", "depend", " ", "on", " ", "the", " ", "vehic", "le", " ", "type", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Cop", "ter", " ", "apps", " ", "shou", "ld", " ", "use", " ", "``", "AUTO", "``", " ", "mode", " ", "for", " ", "\"", "normal", "\"", " ", "waypoint", " ", "missio", "ns", " ", "and", " ", "``", "GUID", "ED", "``", " ", "mode", " ", "other", "wis", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Plan", "e", " ", "and", " ", "Ro", "ver", " ", "apps", " ", "shou", "ld", " ", "use", " ", "the", " ", "``", "AUTO", "``", " ", "mode", " ", "in", " ", "all", " ", "case", "s", ",", " ", "re", "-", "writ", "ing", " ", "the", " ", "missio", "n", " ", "command", "s", " ", "if", " ", "\"", "dynami", "c", "\"", "\\", "10", ";", " ", " ", "behaviour", " ", "is", " ", "require", "d", " ", "(", "the", "y", " ", "support", " ", "only", " ", "a", " ", "limited", " ", "subse", "t", " ", "of", " ", "command", "s", " ", "in", " ", "``", "GUID", "ED", "``", " ", "mode", ").", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Some", " ", "mode", "s", " ", "like", " ", "``", "RETURN", "\\u", "TO", "\\u", "LAUN", "CH", "``", " ", "can", " ", "be", " ", "used", " ", "on", " ", "all", " ", "platform", "s", ".", " ", "Care", " ", "shou", "ld", " ", "be", " ", "take", "n", "\\", "10", ";", " ", " ", "whe", "n", " ", "usi", "ng", " ", "manu", "al", " ", "mode", "s", " ", "as", " ", "these", " ", "may", " ", "require", " ", "remote", " ", "control", " ", "input", " ", "from", " ", "the", " ", "user", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "avail", "able", " ", "set", " ", "of", " ", "support", "ed", " ", "flight", " ", "mode", "s", " ", "is", " ", "vehic", "le", "-", "specific", " ", "(", "see", "\\", "10", ";", " ", " ", " ", " ", "`", "Cop", "ter", " ", "Mode", "s", " ", "<", "http", "://", "cop", "ter", ".", "ard", "upi", "lot", ".", "com", "/", "wiki", "/", "fly", "ing", "-", "ard", "uco", "pte", "r", "/", "flight", "-", "mode", "s", "/>", "`\\u", ",", "\\", "10", ";", " ", " ", " ", " ", "`", "Plan", "e", " ", "Mode", "s", " ", "<", "http", "://", "plane", ".", "ard", "upi", "lot", ".", "com", "/", "wiki", "/", "fly", "ing", "/", "flight", "-", "mode", "s", "/>", "`\\u", ",", "\\", "10", ";", " ", " ", " ", " ", "`", "Ro", "ver", " ", "Mode", "s", " ", "<", "http", "://", "rov", "er", ".", "ard", "upi", "lot", ".", "com", "/", "wiki", "/", "configura", "tion", "-", "2", "/", "#", "mode", "\\u", "meaning", "s", ">`\\u", ").", " ", "If", " ", "an", " ", "unsup", "porte", "d", " ", "mode", " ", "is", " ", "set", " ", "the", " ", "script", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "raise", " ", "a", " ", "``", "Key", "Error", "``", " ", "exception", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "mode", "`", " ", "attribute", " ", "can", " ", "be", " ", "queried", " ", "for", " ", "the", " ", "current", " ", "mode", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "code", " ", "snippet", " ", "belo", "w", " ", "show", "s", " ", "how", " ", "to", " ", "observe", " ", "change", "s", " ", "to", " ", "the", " ", "mode", " ", "and", " ", "then", " ", "read", " ", "the", " ", "value", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "Call", "back", " ", "definit", "ion", " ", "for", " ", "mode", " ", "observer", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "mode", "\\u", "callback", "(", "self", ",", " ", "attr", "\\u", "name", "):", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Vehicle", " ", "Mode", "\",", " ", "self", ".", "mode", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "Add", " ", "observer", " ", "callback", " ", "for", " ", "attribute", " ", "`", "mode", "`", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "add", "\\u", "attribute", "\\u", "listen", "er", "('", "mode", "',", " ", "mode", "\\u", "callback", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "code", " ", "snippet", " ", "belo", "w", " ", "show", "s", " ", "how", " ", "to", " ", "change", " ", "the", " ", "vehic", "le", " ", "mode", " ", "to", " ", "AUTO", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Set", " ", "the", " ", "vehic", "le", " ", "int", "o", " ", "auto", " ", "mode", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "mode", " ", "=", " ", "Vehicle", "Mode", "(\"", "AUTO", "\")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "more", " ", "informati", "on", " ", "on", " ", "getti", "ng", "/", "setti", "ng", "/", "obs", "ervi", "ng", " ", "the", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "mode", "`", "\\", "10", ";", " ", " ", " ", " ", "(", "and", " ", "other", " ", "attribute", "s", ")", " ", "see", " ", "the", " ", ":", "ref", ":`", "attribute", "s", " ", "guide", " ", "<", "vehic", "le", "\\u", "state", "\\u", "attribute", "s", ">`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "name", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "mode", " ", "name", ",", " ", "as", " ", "a", " ", "``", "string", "``.", "\\", "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_", "Vehicle", "Mode_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "Mode_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Vehicle", "Mode", ":", "%", "s", "\"_", "%_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "Mode_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "name_", "==_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "Mode_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "name_", "!=_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "System", "Status_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "object", " ", "is", " ", "used", " ", "to", " ", "get", " ", "and", " ", "set", " ", "the", " ", "current", " ", "\"", "system", " ", "status", "\".\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "object", " ", "of", " ", "this", " ", "type", " ", "is", " ", "return", "ed", " ", "by", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "system", "\\u", "status", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "py", ":", "attribute", "::", " ", "state", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "system", " ", "state", ",", " ", "as", " ", "a", " ", "``", "string", "``.", "\\", "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_", "System", "Status_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "state_", "=_", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Status_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "System", "Status", ":", "%", "s", "\"_", "%_", "self_", "._", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Status_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "state_", "==_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "System", "Status_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "state_", "!=_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Has", "Observer", "s_", "(_", "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_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Has", "Observer", "s_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "mapping", " ", "from", " ", "attr", "\\u", "name", " ", "to", " ", "a", " ", "list", " ", "of", " ", "observers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "attribute", "\\u", "listeners_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "attribute", "\\u", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Has", "Observer", "s_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "attribute", "\\u", "listener_", "(_", "self_", ",_", "attr", "\\u", "name_", ",_", "observer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "an", " ", "attribute", " ", "listen", "er", " ", "callback", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "callback", " ", "function", " ", "(", "``", "observer", "``)", " ", "is", " ", "invoke", "d", " ", "different", "ly", " ", "depend", "ing", " ", "on", " ", "the", " ", "*", "type", " ", "of", " ", "attribute", "*.", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "s", " ", "tha", "t", " ", "represent", " ", "sensor", " ", "values", " ", "or", " ", "whi", "ch", " ", "are", " ", "used", " ", "to", " ", "monit", "or", " ", "connecti", "on", " ", "status", " ", "are", " ", "update", "d", "\\", "10", ";", " ", " ", " ", " ", "whe", "neve", "r", " ", "a", " ", "message", " ", "is", " ", "receive", "d", " ", "from", " ", "the", " ", "vehic", "le", ".", " ", "Attribute", "s", " ", "whi", "ch", " ", "reflect", " ", "vehic", "le", " ", "\"", "state", "\"", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "only", " ", "update", "d", " ", "whe", "n", " ", "thei", "r", " ", "values", " ", "change", " ", "(", "for", " ", "example", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "system", "\\u", "status", "`", ",", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "arme", "d", "`", ",", " ", "and", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "mode", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "callback", " ", "can", " ", "be", " ", "remove", "d", " ", "usi", "ng", " ", ":", "py", ":", "func", ":`", "remove", "\\u", "attribute", "\\u", "listen", "er", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", ":", "py", ":", "func", ":`", "on", "\\u", "attribute", "`", " ", "decorat", "or", " ", "perform", "s", " ", "the", " ", "same", " ", "operati", "on", " ", "as", " ", "this", " ", "method", ",", " ", "but", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "more", " ", "ele", "gan", "t", " ", "synta", "x", ".", " ", "Us", "e", " ", "``", "add", "\\u", "attribute", "\\u", "listen", "er", "``", " ", "by", " ", "preference", " ", "if", " ", "you", " ", "will", " ", "need", " ", "to", " ", "remove", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "observer", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "argu", "ment", " ", "list", " ", "for", " ", "the", " ", "callback", " ", "is", " ", "``", "observer", "(", "object", ",", " ", "attr", "\\u", "name", ",", " ", "attribute", "\\u", "value", ")`", "`", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "self", "``", " ", "-", " ", "the", " ", "associate", "d", " ", ":", "py", ":", "class", ":`", "Vehicle", "`.", " ", "Thi", "s", " ", "may", " ", "be", " ", "compare", "d", " ", "to", " ", "a", " ", "global", " ", "vehic", "le", " ", "handle", "\\", "10", ";", " ", " ", "to", " ", "implement", " ", "vehic", "le", "-", "specific", " ", "callback", " ", "handling", " ", "(", "if", " ", "need", "ed", ").", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "attr", "\\u", "name", "``", " ", "-", " ", "the", " ", "attribute", " ", "name", ".", " ", "Thi", "s", " ", "can", " ", "be", " ", "used", " ", "to", " ", "infer", " ", "whi", "ch", " ", "attribute", " ", "has", " ", "trigger", "ed", "\\", "10", ";", " ", " ", "if", " ", "the", " ", "same", " ", "callback", " ", "is", " ", "used", " ", "for", " ", "watch", "ing", " ", "sever", "al", " ", "attribute", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "value", "``", " ", "-", " ", "the", " ", "attribute", " ", "value", " ", "(", "so", " ", "you", " ", "don", "'", "t", " ", "need", " ", "to", " ", "re", "-", "query", " ", "the", " ", "vehic", "le", " ", "object", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "example", " ", "belo", "w", " ", "show", "s", " ", "how", " ", "to", " ", "get", " ", "callback", "s", " ", "for", " ", "(", "global", ")", " ", "location", " ", "change", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "Call", "back", " ", "to", " ", "print", " ", "the", " ", "location", " ", "in", " ", "global", " ", "frame", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "location", "\\u", "callback", "(", "self", ",", " ", "attr", "\\u", "name", ",", " ", "msg", "):", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Locat", "ion", " ", "(", "Global", "):", " ", "\",", " ", "msg", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "Add", " ", "observer", " ", "for", " ", "the", " ", "vehic", "le", "'", "s", " ", "current", " ", "location", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "add", "\\u", "attribute", "\\u", "listen", "er", "('", "global", "\\u", "frame", "',", " ", "location", "\\u", "callback", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", ":", "ref", ":`", "vehic", "le", "\\u", "state", "\\u", "observe", "\\u", "attribute", "s", "`", " ", "for", " ", "more", " ", "informati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "String", " ", "attr", "\\u", "name", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "attribute", " ", "to", " ", "watch", " ", "(", "or", " ", "'*", "'", " ", "to", " ", "watch", " ", "all", " ", "attribute", "s", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "observer", ":", " ", "The", " ", "callback", " ", "to", " ", "invoke", " ", "whe", "n", " ", "a", " ", "change", " ", "in", " ", "the", " ", "attribute", " ", "is", " ", "detect", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "self_", "._", "\\u", "attribute", "\\u", "listeners_", "._", "get_", "(_", "attr", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "l_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "attribute", "\\u", "listeners_", "[_", "attr", "\\u", "name_", "]_", "=_", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "observer_", "in_", "l_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "._", "append_", "(_", "observer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Has", "Observer", "s_", "(_", "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_", "remove", "\\u", "attribute", "\\u", "listener_", "(_", "self_", ",_", "attr", "\\u", "name_", ",_", "observer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Remove", " ", "an", " ", "attribute", " ", "listen", "er", " ", "(", "observer", ")", " ", "tha", "t", " ", "was", " ", "previ", "ously", " ", "adde", "d", " ", "usi", "ng", " ", ":", "py", ":", "func", ":`", "add", "\\u", "attribute", "\\u", "listen", "er", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "the", " ", "follow", "ing", " ", "line", " ", "wou", "ld", " ", "remove", " ", "a", " ", "previ", "ously", " ", "adde", "d", " ", "vehic", "le", " ", "'", "global", "\\u", "frame", "'", "\\", "10", ";", " ", " ", " ", " ", "observer", " ", "call", "ed", " ", "``", "location", "\\u", "callback", "``", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "remove", "\\u", "attribute", "\\u", "listen", "er", "('", "global", "\\u", "frame", "',", " ", "location", "\\u", "callback", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", ":", "ref", ":`", "vehic", "le", "\\u", "state", "\\u", "observe", "\\u", "attribute", "s", "`", " ", "for", " ", "more", " ", "informati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "String", " ", "attr", "\\u", "name", ":", " ", "The", " ", "attribute", " ", "name", " ", "tha", "t", " ", "is", " ", "to", " ", "have", " ", "an", " ", "observer", " ", "remove", "d", " ", "(", "or", " ", "'*", "'", " ", "to", " ", "remove", " ", "an", " ", "'", "all", " ", "attribute", "'", " ", "observer", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "observer", ":", " ", "The", " ", "callback", " ", "function", " ", "to", " ", "remove", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "self_", "._", "\\u", "attribute", "\\u", "listeners_", "._", "get_", "(_", "attr", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "l_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "._", "remove_", "(_", "observer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "l_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "\\u", "attribute", "\\u", "listeners_", "[_", "attr", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Has", "Observer", "s_", "(_", "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_", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "self_", ",_", "attr", "\\u", "name_", ",_", "value_", ",_", "cache_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "used", " ", "to", " ", "update", " ", "attribute", " ", "observer", "s", " ", "whe", "n", " ", "the", " ", "named", " ", "attribute", " ", "is", " ", "update", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "shou", "ld", " ", "call", " ", "it", " ", "in", " ", "your", " ", "message", " ", "listeners", " ", "after", " ", "updat", "ing", " ", "an", " ", "attribute", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "informati", "on", " ", "from", " ", "a", " ", "vehic", "le", " ", "message", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "default", " ", "the", " ", "value", " ", "of", " ", "``", "cache", "``", " ", "is", " ", "``", "Fal", "se", "``", " ", "and", " ", "every", " ", "update", " ", "from", " ", "the", " ", "vehic", "le", " ", "is", " ", "sent", " ", "to", " ", "listeners", "\\", "10", ";", " ", " ", " ", " ", "(", "whe", "ther", " ", "or", " ", "not", " ", "the", " ", "attribute", " ", "has", " ", "change", "d", ").", " ", " ", "Thi", "s", " ", "is", " ", "appropr", "iate", " ", "for", " ", "attribute", "s", " ", "whi", "ch", " ", "represent", " ", "sensor", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "heart", "beat", "-", "type", " ", "monitorin", "g", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "``", "cache", "=", "Tru", "e", "``", " ", "to", " ", "update", " ", "listeners", " ", "only", " ", "whe", "n", " ", "the", " ", "value", " ", "actual", "ly", " ", "change", "s", " ", "(", "cache", " ", "the", " ", "previ", "ous", "\\", "10", ";", " ", " ", " ", " ", "attribute", " ", "value", ").", " ", "Thi", "s", " ", "shou", "ld", " ", "be", " ", "used", " ", "where", " ", "clients", " ", "will", " ", "only", " ", "ever", " ", "need", " ", "to", " ", "know", " ", "the", " ", "value", " ", "whe", "n", " ", "it", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "change", "d", ".", " ", "For", " ", "example", ",", " ", "this", " ", "setti", "ng", " ", "has", " ", "bee", "n", " ", "used", " ", "for", " ", "notif", "ying", " ", ":", "py", ":", "attr", ":`", "mode", "`", " ", "change", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", ":", "ref", ":`", "example", "\\u", "create", "\\u", "attribute", "`", " ", "for", " ", "more", " ", "informati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "String", " ", "attr", "\\u", "name", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "attribute", " ", "tha", "t", " ", "has", " ", "bee", "n", " ", "update", "d", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", "The", " ", "current", " ", "value", " ", "of", " ", "the", " ", "attribute", " ", "tha", "t", " ", "has", " ", "bee", "n", " ", "update", "d", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "Boo", "lean", " ", "cache", ":", " ", "Set", " ", "``", "Tru", "e", "``", " ", "to", " ", "only", " ", "notif", "y", " ", "observer", "s", " ", "whe", "n", " ", "the", " ", "attribute", " ", "value", " ", "change", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Cache", "d", " ", "values", " ", "are", " ", "not", " ", "re", "-", "sent", " ", "if", " ", "the", "y", " ", "are", " ", "unchanged", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "attr", "\\u", "name_", "in_", "self_", "._", "\\u", "attribute", "\\u", "cache_", "and_", "self_", "._", "\\u", "attribute", "\\u", "cache_", "[_", "attr", "\\u", "name_", "]_", "==_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "attribute", "\\u", "cache_", "[_", "attr", "\\u", "name_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Noti", "fy", " ", "observer", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "fn_", "in_", "self_", "._", "\\u", "attribute", "\\u", "listeners_", "._", "get_", "(_", "attr", "\\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 ", " _", "fn_", "(_", "self_", ",_", "attr", "\\u", "name_", ",_", "value_", ")_", "\\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 ", " _", "err", "printer_", "(_", "'>>", ">", " ", "Except", "ion", " ", "in", " ", "attribute", " ", "handler", " ", "for", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "attr", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "printer_", "(_", "'>>", ">", " ", "'_", "+_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "fn_", "in_", "self_", "._", "\\u", "attribute", "\\u", "listeners_", "._", "get_", "(_", "'*'_", ",_", "[_", "]_", ")_", ":_", "\\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 ", " _", "fn_", "(_", "self_", ",_", "attr", "\\u", "name_", ",_", "value_", ")_", "\\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 ", " _", "err", "printer_", "(_", "'>>", ">", " ", "Except", "ion", " ", "in", " ", "attribute", " ", "handler", " ", "for", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "attr", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "printer_", "(_", "'>>", ">", " ", "'_", "+_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Has", "Observer", "s_", "(_", "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_", "on", "\\u", "attribute_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Decorat", "or", " ", "for", " ", "attribute", " ", "listeners", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "decorated", " ", "function", " ", "(", "``", "observer", "``)", " ", "is", " ", "invoke", "d", " ", "different", "ly", " ", "depend", "ing", " ", "on", " ", "the", " ", "*", "type", " ", "of", " ", "attribute", "*.", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "s", " ", "tha", "t", " ", "represent", " ", "sensor", " ", "values", " ", "or", " ", "whi", "ch", " ", "are", " ", "used", " ", "to", " ", "monit", "or", " ", "connecti", "on", " ", "status", " ", "are", " ", "update", "d", "\\", "10", ";", " ", " ", " ", " ", "whe", "neve", "r", " ", "a", " ", "message", " ", "is", " ", "receive", "d", " ", "from", " ", "the", " ", "vehic", "le", ".", " ", "Attribute", "s", " ", "whi", "ch", " ", "reflect", " ", "vehic", "le", " ", "\"", "state", "\"", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "only", " ", "update", "d", " ", "whe", "n", " ", "thei", "r", " ", "values", " ", "change", " ", "(", "for", " ", "example", " ", ":", "py", ":", "func", ":`", "Vehicle", ".", "system", "\\u", "status", "`", ",", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "arme", "d", "`", ",", " ", "and", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "mode", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "argu", "ment", " ", "list", " ", "for", " ", "the", " ", "callback", " ", "is", " ", "``", "observer", "(", "object", ",", " ", "attr", "\\u", "name", ",", " ", "attribute", "\\u", "value", ")`", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "self", "``", " ", "-", " ", "the", " ", "associate", "d", " ", ":", "py", ":", "class", ":`", "Vehicle", "`.", " ", "Thi", "s", " ", "may", " ", "be", " ", "compare", "d", " ", "to", " ", "a", " ", "global", " ", "vehic", "le", " ", "handle", "\\", "10", ";", " ", " ", "to", " ", "implement", " ", "vehic", "le", "-", "specific", " ", "callback", " ", "handling", " ", "(", "if", " ", "need", "ed", ").", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "attr", "\\u", "name", "``", " ", "-", " ", "the", " ", "attribute", " ", "name", ".", " ", "Thi", "s", " ", "can", " ", "be", " ", "used", " ", "to", " ", "infer", " ", "whi", "ch", " ", "attribute", " ", "has", " ", "trigger", "ed", "\\", "10", ";", " ", " ", "if", " ", "the", " ", "same", " ", "callback", " ", "is", " ", "used", " ", "for", " ", "watch", "ing", " ", "sever", "al", " ", "attribute", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "msg", "``", " ", "-", " ", "the", " ", "attribute", " ", "value", " ", "(", "so", " ", "you", " ", "don", "'", "t", " ", "need", " ", "to", " ", "re", "-", "query", " ", "the", " ", "vehic", "le", " ", "object", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "There", " ", "is", " ", "no", " ", "way", " ", "to", " ", "remove", " ", "an", " ", "attribute", " ", "listen", "er", " ", "adde", "d", " ", "with", " ", "this", " ", "decorat", "or", ".", " ", "Us", "e", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "func", ":`", "add", "\\u", "attribute", "\\u", "listen", "er", "`", " ", "if", " ", "you", " ", "need", " ", "to", " ", "be", " ", "able", " ", "to", " ", "remove", "\\", "10", ";", " ", " ", " ", " ", "the", " ", ":", "py", ":", "func", ":`", "attribute", " ", "listen", "er", " ", "<", "remove", "\\u", "attribute", "\\u", "listen", "er", ">`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "code", " ", "fragment", " ", "belo", "w", " ", "show", "s", " ", "how", " ", "you", " ", "can", " ", "create", " ", "a", " ", "listen", "er", " ", "for", " ", "the", " ", "atti", "tude", " ", "attribute", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "vehic", "le", ".", "on", "\\u", "attribute", "('", "atti", "tude", "')", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "atti", "tude", "\\u", "listen", "er", "(", "self", ",", " ", "name", ",", " ", "msg", "):", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "'%", "s", " ", "attribute", " ", "is", ":", " ", "%", "s", "'", " ", "%", " ", "(", "name", ",", " ", "msg", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", ":", "ref", ":`", "vehic", "le", "\\u", "state", "\\u", "observe", "\\u", "attribute", "s", "`", " ", "for", " ", "more", " ", "informati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "String", " ", "attr", "\\u", "name", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "attribute", " ", "to", " ", "watch", " ", "(", "or", " ", "'*", "'", " ", "to", " ", "watch", " ", "all", " ", "attribute", "s", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "observer", ":", " ", "The", " ", "callback", " ", "to", " ", "invoke", " ", "whe", "n", " ", "a", " ", "change", " ", "in", " ", "the", " ", "attribute", " ", "is", " ", "detect", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\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 ", " _", "if_", "isinstance_", "(_", "name_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "n_", "in_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "add", "\\u", "attribute", "\\u", "listener_", "(_", "n_", ",_", "fn_", ")_", "\\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_", "._", "add", "\\u", "attribute", "\\u", "listener_", "(_", "name_", ",_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Chan", "nels", "Override", "_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "dictionar", "y", " ", "class", " ", "for", " ", "mana", "ging", " ", "Vehicle", " ", "channel", " ", "override", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Chan", "nels", " ", "can", " ", "be", " ", "read", ",", " ", "writt", "en", ",", " ", "or", " ", "clear", "ed", " ", "by", " ", "index", " ", "or", " ", "usi", "ng", " ", "a", " ", "dictionar", "y", " ", "synta", "x", ".", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "clear", " ", "a", " ", "value", ",", " ", "set", " ", "it", " ", "to", " ", "``", "Non", "e", "``", " ", "or", " ", "use", " ", "``", "del", "``", " ", "on", " ", "the", " ", "item", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "object", " ", "of", " ", "this", " ", "type", " ", "is", " ", "return", "ed", " ", "by", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "channel", "s", ".", "override", "s", " ", "<", "Chan", "nels", ".", "override", "s", ">`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "more", " ", "informati", "on", " ", "and", " ", "example", "s", " ", "see", " ", ":", "ref", ":`", "example", "\\u", "channel", "\\u", "override", "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_", "\\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_", "Chan", "nels", "Override", "_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "vehicle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "vehicle_", "=_", "vehicle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "count_", "=_", "8_", "#", " ", "Fix", "ed", " ", "by", " ", "MAV", "Link_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "active_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chan", "nels", "Override", "_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dict_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "str_", "(_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chan", "nels", "Override", "_", "(_", "dict_", ")_", ":_", "\\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 ", " _", "if_", "not_", "(_", "int_", "(_", "key_", ")_", ">_", "0_", "and_", "int_", "(_", "key_", ")_", "<=_", "self_", "._", "\\u", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Inva", "lid", " ", "channel", " ", "index", " ", "%", "s", "'_", "%_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "value_", ":_", "\\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 ", " _", "dict_", "._", "\\u\\u", "delitem\\u\\u_", "(_", "self_", ",_", "str_", "(_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dict_", "._", "\\u\\u", "setitem\\u\\u_", "(_", "self_", ",_", "str_", "(_", "key_", ")_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "send_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chan", "nels", "Override", "_", "(_", "dict_", ")_", ":_", "\\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 ", " _", "dict_", "._", "\\u\\u", "delitem\\u\\u_", "(_", "self_", ",_", "str_", "(_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "send_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chan", "nels", "Override", "_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chan", "nels", "Override", "_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "send_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "overrides_", "=_", "[_", "0_", "]_", "*_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "self_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "overrides_", "[_", "int_", "(_", "k_", ")_", "-_", "1_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "master_", "._", "mav_", "._", "rc", "\\u", "channel", "s", "\\u", "override", "\\u", "send_", "(_", "0_", ",_", "0_", ",_", "*_", "overrides_", ")_", "\\u\\u\\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_", "Channels_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "dictionar", "y", " ", "class", " ", "for", " ", "mana", "ging", " ", "RC", " ", "channel", " ", "informati", "on", " ", "associate", "d", " ", "with", " ", "a", " ", ":", "py", ":", "class", ":`", "Vehicle", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "object", " ", "of", " ", "this", " ", "type", " ", "is", " ", "accesse", "d", " ", "through", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "channel", "s", "`.", " ", "Thi", "s", " ", "object", " ", "als", "o", " ", "store", "s", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "current", " ", "vehic", "le", " ", "channel", " ", "override", "s", " ", "through", " ", "its", " ", ":", "py", ":", "attr", ":`", "override", "s", "`", " ", "attribute", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "more", " ", "informati", "on", " ", "and", " ", "example", "s", " ", "see", " ", ":", "ref", ":`", "example", "\\u", "channel", "\\u", "override", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Channels_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "vehicle_", ",_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "vehicle_", "=_", "vehicle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "count_", "=_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "overrides_", "=_", "Chan", "nels", "Override", "_", "(_", "vehicle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "populate", " ", "read", "back_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "readonly_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "range_", "(_", "0_", ",_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "[_", "k_", "+_", "1_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "readonly_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channels_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "count_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "number", " ", "of", " ", "channel", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "dictionar", "y", " ", "(", "currentl", "y", " ", "8", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channels_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dict_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "str_", "(_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channels_", "(_", "dict_", ")_", ":_", "\\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 ", " _", "if_", "self_", "._", "\\u", "readonly_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'\\u", "\\u", "setitem", "\\u\\u", " ", "is", " ", "not", " ", "support", "ed", " ", "on", " ", "Chan", "nels", " ", "object", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dict_", "._", "\\u\\u", "setitem\\u\\u_", "(_", "self_", ",_", "str_", "(_", "key_", ")_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channels_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channels_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update", "\\u", "channel_", "(_", "self_", ",_", "channel_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "have", " ", "channel", "s", " ", "on", " ", "different", " ", "port", "s", ",", " ", "we", " ", "expand", " ", "the", " ", "Channels_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "object", " ", "to", " ", "support", " ", "them", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "channel_", "=_", "int_", "(_", "channel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "readonly_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "[_", "channel_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "readonly_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "count_", "=_", "max_", "(_", "self_", "._", "\\u", "count_", ",_", "channel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channels_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "overrides_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Attribute", " ", "to", " ", "read", ",", " ", "set", " ", "and", " ", "clear", " ", "channel", " ", "override", "s", " ", "(", "als", "o", " ", "know", "n", " ", "as", " ", "\"", "rc", " ", "override", "s", "\")", "\\", "10", ";", " ", " ", " ", " ", "associate", "d", " ", "with", " ", "a", " ", ":", "py", ":", "class", ":`", "Vehicle", "`", " ", "(", "via", " ", ":", "py", ":", "class", ":`", "Vehicle", ".", "channel", "s", "`)", ".", " ", "Thi", "s", " ", "is", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "of", " ", "type", " ", ":", "py", ":", "class", ":`", "Chan", "nels", "Override", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "more", " ", "informati", "on", " ", "and", " ", "example", "s", " ", "see", " ", ":", "ref", ":`", "example", "\\u", "channel", "\\u", "override", "s", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "set", " ", "channel", " ", "override", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Set", " ", "and", " ", "clear", " ", "overrid", "s", " ", "usi", "ng", " ", "dictionar", "y", " ", "synta", "x", " ", "(", "clear", " ", "by", " ", "setti", "ng", " ", "override", " ", "to", " ", "none", ")", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "channel", "s", ".", "override", "s", " ", "=", " ", "{", "'", "5", "':", "Non", "e", ",", " ", "'", "6", "':", "Non", "e", ",'", "3", "':", "500", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "You", " ", "can", " ", "als", "o", " ", "set", " ", "and", " ", "clear", " ", "override", "s", " ", "usi", "ng", " ", "indexing", " ", "synta", "x", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "channel", "s", ".", "override", "s", "['", "2", "']", " ", "=", " ", "200", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "channel", "s", ".", "override", "s", "['", "2", "']", " ", "=", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Clear", " ", "usi", "ng", " ", "'", "del", "'", "\\", "10", ";", " ", " ", " ", " ", "del", " ", "vehic", "le", ".", "channel", "s", ".", "override", "s", "['", "3", "']", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Clear", " ", "all", " ", "override", "s", " ", "by", " ", "setti", "ng", " ", "an", " ", "empty", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "channel", "s", ".", "override", "s", " ", "=", " ", "{}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Read", " ", "the", " ", "channel", " ", "override", "s", " ", "eit", "her", " ", "as", " ", "a", " ", "dictionar", "y", " ", "or", " ", "by", " ", "index", ".", " ", "Not", "e", " ", "tha", "t", " ", "you", "'", "ll", " ", "get", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "``", "Key", "Error", "``", " ", "exception", " ", "if", " ", "you", " ", "read", " ", "a", " ", "channel", " ", "override", " ", "tha", "t", " ", "has", " ", "not", " ", "bee", "n", " ", "set", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Get", " ", "all", " ", "channel", " ", "override", "s", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", " ", "Chan", "nel", " ", "override", "s", ":", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "channel", "s", ".", "override", "s", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Print", " ", "just", " ", "one", " ", "channel", " ", "override", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", " ", "Ch", "2", " ", "override", ":", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "channel", "s", ".", "override", "s", "['", "2", "']", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "overrides_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channels_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "overrides_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "overrides_", "(_", "self_", ",_", "newc", "h_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "overrides_", "._", "\\u", "active_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "overrides_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "newc", "h_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "overrides_", "[_", "str_", "(_", "k_", ")_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "self_", "._", "\\u", "overrides_", "[_", "str_", "(_", "k_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "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_", "self_", "._", "\\u", "overrides_", "._", "\\u", "active_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "overrides_", "._", "\\u", "send_", "(_", ")_", "\\u\\u\\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_", "Locations_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "object", " ", "for", " ", "holding", " ", "location", " ", "informati", "on", " ", "in", " ", "global", ",", " ", "global", " ", "relative", " ", "and", " ", "local", " ", "frames", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "class", ":`", "Vehicle", "`", " ", "owns", " ", "an", " ", "object", " ", "of", " ", "this", " ", "type", ".", " ", "See", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "location", "`", " ", "for", " ", "informati", "on", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "readi", "ng", " ", "and", " ", "obs", "ervi", "ng", " ", "location", " ", "in", " ", "the", " ", "different", " ", "frames", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "different", " ", "frames", " ", "are", " ", "accesse", "d", " ", "through", " ", "the", " ", "member", "s", ",", " ", "whi", "ch", " ", "are", " ", "created", " ", "with", " ", "this", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "The", "y", " ", "can", " ", "be", " ", "read", ",", " ", "and", " ", "are", " ", "observable", ".", "\\", "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_", "Locations_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "vehicle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Locations_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "lat_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lon_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "alt_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "relative", "\\u", "alt_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "vehicle_", "._", "on", "\\u", "message_", "(_", "'", "GLOB", "AL", "\\u", "POSITION", "\\u", "INT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "vehicle_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "self_", "._", "\\u", "lat_", ",_", "self_", "._", "\\u", "lon_", ")_", "=_", "(_", "m_", "._", "lat_", "/_", "1.0", "e7", "_", ",_", "m_", "._", "lon_", "/_", "1.0", "e7", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "relative", "\\u", "alt_", "=_", "m_", "._", "relative", "\\u", "alt_", "/_", "1000.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "global", "\\u", "relative", "\\u", "frame", "'_", ",_", "self_", "._", "global", "\\u", "relative", "\\u", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vehicle_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "location", ".", "global", "\\u", "relative", "\\u", "frame", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vehicle_", "._", "location_", "._", "global", "\\u", "relative", "\\u", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "alt_", "!=_", "None_", "or_", "m_", "._", "alt_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Requ", "ire", " ", "first", " ", "alt", " ", "value", " ", "to", " ", "be", " ", "non", "-0", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "is", " ", "this", " ", "the", " ", "proper", " ", "check", " ", "to", " ", "do", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "alt_", "=_", "m_", "._", "alt_", "/_", "1000.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "global", "\\u", "frame", "'_", ",_", "self_", "._", "global", "\\u", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vehicle_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "location", ".", "global", "\\u", "frame", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vehicle_", "._", "location_", "._", "global", "\\u", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vehicle_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "location", "'_", ",_", "vehicle_", "._", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "north_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "east_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "down_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "vehicle_", "._", "on", "\\u", "message_", "(_", "'", "LOCAL", "\\u", "POSITION", "\\u", "NED", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "vehicle_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "north_", "=_", "m_", "._", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "east_", "=_", "m_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "down_", "=_", "m_", "._", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "local", "\\u", "frame", "'_", ",_", "self_", "._", "local", "\\u", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vehicle_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "location", ".", "local", "\\u", "frame", "'_", ",_", "vehicle_", "._", "location_", "._", "local", "\\u", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vehicle_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "location", "'_", ",_", "vehicle_", "._", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Locations_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "local", "\\u", "frame_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Locat", "ion", " ", "in", " ", "local", " ", "NED", " ", "frame", " ", "(", "a", " ", ":", "py", ":", "class", ":`", "Locat", "ion", "Global", "Relative", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "accesse", "d", " ", "through", " ", "the", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "location", "`", " ", "attribute", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Local", " ", "Locat", "ion", ":", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "location", ".", "local", "\\u", "frame", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "location", " ", "will", " ", "not", " ", "start", " ", "to", " ", "update", " ", "unti", "l", " ", "the", " ", "vehic", "le", " ", "is", " ", "arme", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Locat", "ion", "Local_", "(_", "self_", "._", "\\u", "north_", ",_", "self_", "._", "\\u", "east_", ",_", "self_", "._", "\\u", "down_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Locations_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "global", "\\u", "frame_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Locat", "ion", " ", "in", " ", "global", " ", "frame", " ", "(", "a", " ", ":", "py", ":", "class", ":`", "Locat", "ion", "Global", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "latitude", " ", "and", " ", "longitude", " ", "are", " ", "relative", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "`", "WG", "S", "84", " ", "coordinate", " ", "system", " ", "<", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "Wor", "ld", "\\u", "Geo", "det", "ic", "\\u", "System", ">`\\u", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "alti", "tude", " ", "is", " ", "relative", " ", "to", " ", "mean", " ", "sea", "-", "level", " ", "(", "MS", "L", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "accesse", "d", " ", "through", " ", "the", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "location", "`", " ", "attribute", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Global", " ", "Locat", "ion", ":", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "location", ".", "global", "\\u", "frame", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Sea", " ", "level", " ", "alti", "tude", " ", "is", ":", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "location", ".", "global", "\\u", "frame", ".", "alt", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", "s", " ", "``", "lat", "``", " ", "and", " ", "``", "lon", "``", " ", "attribute", "s", " ", "are", " ", "populate", "d", " ", "short", "ly", " ", "after", " ", "GPS", " ", "bec", "ome", "s", " ", "avail", "able", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "``", "alt", "``", " ", "can", " ", "take", " ", "sever", "al", " ", "second", "s", " ", "long", "er", " ", "to", " ", "populate", " ", "(", "from", " ", "the", " ", "bar", "ometer", ").", "\\", "10", ";", " ", " ", " ", " ", "Listen", "ers", " ", "are", " ", "not", " ", "notified", " ", "of", " ", "change", "s", " ", "to", " ", "this", " ", "attribute", " ", "unti", "l", " ", "it", " ", "has", " ", "full", "y", " ", "populate", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "watch", " ", "for", " ", "change", "s", " ", "you", " ", "can", " ", "use", " ", ":", "py", ":", "func", ":`", "Vehicle", ".", "on", "\\u", "attribute", "`", " ", "decorat", "or", " ", "or", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "func", ":`", "add", "\\u", "attribute", "\\u", "listen", "er", "`", " ", "(", "decorat", "or", " ", "appro", "ach", " ", "shown", " ", "belo", "w", "):", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "vehic", "le", ".", "on", "\\u", "attribute", "('", "location", ".", "global", "\\u", "frame", "')", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "listen", "er", "(", "self", ",", " ", "attr", "\\u", "name", ",", " ", "value", "):", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", " ", "Global", ":", " ", "%", "s", "\"", " ", "%", " ", "value", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "Alternative", "ly", ",", " ", "use", " ", "decorat", "or", ":", " ", "``", "@", "vehic", "le", ".", "location", ".", "on", "\\u", "attribute", "('", "global", "\\u", "frame", "')", "``.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Locat", "ion", "Global_", "(_", "self_", "._", "\\u", "lat_", ",_", "self_", "._", "\\u", "lon_", ",_", "self_", "._", "\\u", "alt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Locations_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "global", "\\u", "relative", "\\u", "frame_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Locat", "ion", " ", "in", " ", "global", " ", "frame", ",", " ", "with", " ", "alti", "tude", " ", "relative", " ", "to", " ", "the", " ", "home", " ", "location", "\\", "10", ";", " ", " ", " ", " ", "(", "a", " ", ":", "py", ":", "class", ":`", "Locat", "ion", "Global", "Relative", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "latitude", " ", "and", " ", "longitude", " ", "are", " ", "relative", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "`", "WG", "S", "84", " ", "coordinate", " ", "system", " ", "<", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "Wor", "ld", "\\u", "Geo", "det", "ic", "\\u", "System", ">`\\u", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "alti", "tude", " ", "is", " ", "relative", " ", "to", " ", ":", "py", ":", "attr", ":`", "home", " ", "location", " ", "<", "Vehicle", ".", "home", "\\u", "location", ">`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "accesse", "d", " ", "through", " ", "the", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "location", "`", " ", "attribute", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Global", " ", "Locat", "ion", " ", "(", "relative", " ", "alti", "tude", "):", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "location", ".", "global", "\\u", "relative", "\\u", "frame", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Alt", "itu", "de", " ", "relative", " ", "to", " ", "home", "\\u", "location", ":", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "location", ".", "global", "\\u", "relative", "\\u", "frame", ".", "alt", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Locat", "ion", "Global", "Relative", "_", "(_", "self_", "._", "\\u", "lat_", ",_", "self_", "._", "\\u", "lon_", ",_", "self_", "._", "\\u", "relative", "\\u", "alt_", ")_", "\\u\\u\\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_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "main", " ", "vehic", "le", " ", "API", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Vehicle", " ", "state", " ", "is", " ", "exposed", " ", "through", " ", "'", "attribute", "s", "'", " ", "(", "e", ".", "g", ".", " ", ":", "py", ":", "attr", ":`", "heading", "`)", ".", " ", "All", " ", "attribute", "s", " ", "can", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "read", ",", " ", "and", " ", "some", " ", "are", " ", "als", "o", " ", "sett", "able", "\\", "10", ";", " ", " ", " ", " ", "(:", "py", ":", "attr", ":`", "mode", "`", ",", " ", ":", "py", ":", "attr", ":`", "arme", "d", "`", " ", "and", " ", ":", "py", ":", "attr", ":`", "home", "\\u", "location", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "s", " ", "can", " ", "als", "o", " ", "be", " ", "async", "hronous", "ly", " ", "monitored", " ", "for", " ", "change", "s", " ", "by", " ", "register", "ing", " ", "listen", "er", " ", "callback", "\\", "10", ";", " ", " ", " ", " ", "function", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Vehicle", " ", "\"", "settings", "\"", " ", "(", "parameter", "s", ")", " ", "are", " ", "read", "/", "set", " ", "usi", "ng", " ", "the", " ", ":", "py", ":", "attr", ":`", "parameter", "s", "`", " ", "attribute", ".", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", " ", "can", " ", "be", " ", "iterate", "d", " ", "and", " ", "are", " ", "als", "o", " ", "individual", "ly", " ", "observable", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Vehicle", " ", "movement", " ", "is", " ", "prima", "ri", "ly", " ", "controlle", "d", " ", "usi", "ng", " ", "the", " ", ":", "py", ":", "attr", ":`", "arme", "d", "`", " ", "attribute", " ", "and", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "func", ":`", "simple", "\\u", "take", "off", "`", " ", "and", " ", ":", "py", ":", "func", ":`", "simple", "\\u", "got", "o", "`", " ", "in", " ", "GUID", "ED", " ", "mode", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "is", " ", "als", "o", " ", "possib", "le", " ", "to", " ", "work", " ", "with", " ", "vehic", "le", " ", "\"", "missio", "ns", "\"", " ", "usi", "ng", " ", "the", " ", ":", "py", ":", "attr", ":`", "command", "s", "`", " ", "attribute", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "run", " ", "them", " ", "in", " ", "AUTO", " ", "mode", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "guide", " ", "contain", "s", " ", "more", " ", "detailed", " ", "informati", "on", " ", "on", " ", "the", " ", "different", " ", "way", "s", " ", "you", " ", "can", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "``", "Vehicle", "``", " ", "class", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", ":", "doc", ":`", "guide", "/", "vehic", "le", "\\u", "state", "\\u", "and", "\\u", "parameter", "s", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", ":", "doc", ":`", "guide", "/", "cop", "ter", "/", "guide", "d\\u", "mode", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", ":", "doc", ":`", "guide", "/", "auto", "\\u", "mode", "`", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "class", " ", "currentl", "y", " ", "expos", "es", " ", "just", " ", "the", " ", "attribute", "s", " ", "tha", "t", " ", "are", " ", "most", " ", "common", "ly", " ", "used", " ", "by", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", " ", "types", ".", " ", "if", " ", "you", " ", "need", " ", "to", " ", "add", " ", "addition", "al", " ", "attribute", "s", " ", "then", " ", "subclass", " ", "``", "Vehicle", "``", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "demonstrat", "ed", " ", "in", " ", ":", "doc", ":`", "example", "s", "/", "create", "\\u", "attribute", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ple", "ase", " ", "then", " ", ":", "doc", ":`", "contribute", " ", "<", "contrib", "uti", "ng", "/", "contributions", "\\u", "api", ">`", " ", "your", " ", "additions", " ", "back", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "project", "!", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Priva", "te", " ", "sugar", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Opera", "tion", "s", " ", "to", " ", "support", " ", "the", " ", "standard", " ", "API", "._", "\\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\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u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Vehicle", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "handler_", "=_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "master_", "=_", "handler_", "._", "master_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cache", " ", "all", " ", "update", "d", " ", "attribute", "s", " ", "for", " ", "wait", "\\u", "read", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "By", " ", "default", ",", " ", "we", " ", "presu", "me", " ", "all", " ", "\"", "command", "s", "\"", " ", "are", " ", "load", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "read", "y", "\\u", "attrs_", "=_", "set_", "(_", "[_", "'", "command", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Default", " ", "parameter", "s", " ", "whe", "n", " ", "calling", " ", "wait", "\\u", "read", "y", "()", " ", "or", " ", "wait", "\\u", "read", "y", "(", "Tru", "e", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "default", "\\u", "read", "y", "\\u", "attrs_", "=_", "[_", "'", "parameter", "s", "'_", ",_", "'", "gps", "\\u", "0", "'_", ",_", "'", "arme", "d", "'_", ",_", "'", "mode", "'_", ",_", "'", "atti", "tude", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "attribute_", "(_", "'*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "\\u_", ",_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "read", "y", "\\u", "attrs_", "._", "add_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Attache", "s", " ", "message", " ", "listeners", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "message", "\\u", "listeners_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "handler_", "._", "forward", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "\\u_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "notif", "y", "\\u", "message", "\\u", "listeners_", "(_", "msg_", "._", "get", "\\u", "type_", "(_", ")_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "location_", "=_", "Locations_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vx_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vy_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vz", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "GLOB", "AL", "\\u", "POSITION", "\\u", "INT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "self_", "._", "\\u", "vx_", ",_", "self_", "._", "\\u", "vy_", ",_", "self_", "._", "\\u", "vz", "_", ")_", "=_", "(_", "m_", "._", "vx_", "/_", "100.0_", ",_", "m_", "._", "vy_", "/_", "100.0_", ",_", "m_", "._", "vz", "_", "/_", "100.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "velo", "city", "'_", ",_", "self_", "._", "velocity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "pitch_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "yaw_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "roll_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pitch", "speed_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "yaw", "speed_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "roll", "speed_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "ATT", "ITU", "DE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "pitch_", "=_", "m_", "._", "pitch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "yaw_", "=_", "m_", "._", "yaw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "roll_", "=_", "m_", "._", "roll_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pitch", "speed_", "=_", "m_", "._", "pitch", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "yaw", "speed_", "=_", "m_", "._", "yaw", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "roll", "speed_", "=_", "m_", "._", "roll", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "atti", "tude", "'_", ",_", "self_", "._", "atti", "tude", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "heading_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "airs", "peed", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ground", "speed_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "VF", "R", "\\u", "HU", "D", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "heading_", "=_", "m_", "._", "heading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "heading", "'_", ",_", "self_", "._", "heading_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "airs", "peed", "_", "=_", "m_", "._", "airs", "peed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "airs", "peed", "'_", ",_", "self_", "._", "airs", "peed", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ground", "speed_", "=_", "m_", "._", "ground", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "ground", "speed", "'_", ",_", "self_", "._", "ground", "speed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "rng", "fn", "d\\u", "distance_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "rng", "fn", "d\\u", "voltage_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "RANGE", "FIND", "ER", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "rng", "fn", "d\\u", "distance_", "=_", "m_", "._", "distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "rng", "fn", "d\\u", "voltage_", "=_", "m_", "._", "voltage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "range", "finde", "r", "'_", ",_", "self_", "._", "range", "finder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "mount", "\\u", "pitch_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mount", "\\u", "yaw_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mount", "\\u", "roll_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "MOUNT", "\\u", "STATUS", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mount", "\\u", "pitch_", "=_", "m_", "._", "pointi", "ng", "\\u", "a_", "/_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mount", "\\u", "roll_", "=_", "m_", "._", "pointi", "ng", "\\u", "b_", "/_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mount", "\\u", "yaw_", "=_", "m_", "._", "pointi", "ng", "\\u", "c_", "/_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "mount", "'_", ",_", "self_", "._", "mount", "\\u", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "capabilities_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "raw", "\\u", "version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "autop", "ilo", "t", "\\u", "version", "\\u", "msg", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "AUTO", "PI", "LOT", "\\u", "VERSI", "ON", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "vehicle_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "capabilities_", "=_", "m_", "._", "capabilities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "raw", "\\u", "version_", "=_", "m_", "._", "flight", "\\u", "sw", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "autop", "ilo", "t", "\\u", "version", "\\u", "msg", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "capabilities_", "!=_", "0_", "or_", "self_", "._", "\\u", "autop", "ilo", "t", "\\u", "version", "\\u", "msg", "\\u", "count_", ">_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ar", "du", "Pilo", "t", " ", "<", "3.4", " ", "fail", "s", " ", "to", " ", "send", " ", "capab", "ilities", " ", "correct", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "straight", " ", "after", " ", "boot", ",", " ", "and", " ", "even", " ", "older", " ", "version", "s", " ", "send_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "back", " ", "as", " ", "alw", "ay", "s", "-0", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vehicle_", "._", "remove", "\\u", "message", "\\u", "listener_", "(_", "'", "HEA", "RT", "BEA", "T", "'_", ",_", "self_", "._", "send", "\\u", "capab", "ilt", "ies", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "autop", "ilo", "t", "\\u", "version", "'_", ",_", "self_", "._", "\\u", "raw", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gi", "mba", "l_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "gi", "mba", "l_", "=_", "Gi", "mba", "l_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "keys", " ", "are", " ", "string", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "channels_", "=_", "Channels_", "(_", "self_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "RC", "\\u", "CHANNELS", "\\u", "RA", "W", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set\\u", "rc_", "(_", "chn", "um_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Priva", "te", " ", "utility", " ", "for", " ", "handling", " ", "rc", " ", "channel", " ", "message", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "use", " ", "port", " ", "to", " ", "allow", " ", "ch", " ", "nums", " ", "great", "er", " ", "than", " ", "8_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "channels_", "._", "\\u", "update", "\\u", "channel_", "(_", "str_", "(_", "m_", "._", "port_", "*_", "8_", "+_", "chn", "um_", ")_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "set\\u", "rc_", "(_", "1_", ",_", "m_", "._", "chan", "1", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "rc_", "(_", "2_", ",_", "m_", "._", "chan", "2", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "rc_", "(_", "3_", ",_", "m_", "._", "chan", "3", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "rc_", "(_", "4_", ",_", "m_", "._", "chan", "4", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "rc_", "(_", "5_", ",_", "m_", "._", "chan", "5", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "rc_", "(_", "6_", ",_", "m_", "._", "chan", "6", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "rc_", "(_", "7_", ",_", "m_", "._", "chan", "7", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "rc_", "(_", "8_", ",_", "m_", "._", "chan", "8", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "channel", "s", "'_", ",_", "self_", "._", "channels_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "voltage_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "current_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "level_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "SYS", "\\u", "STATUS", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "voltage_", "=_", "m_", "._", "voltage", "\\u", "battery", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "current_", "=_", "m_", "._", "current", "\\u", "battery", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "level_", "=_", "m_", "._", "battery", "\\u", "remaining_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "battery", "'_", ",_", "self_", "._", "battery", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "eph", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ep", "v_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "satellite", "s", "\\u", "visible_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "fix", "\\u", "type_", "=_", "None_", "#", " ", "FIX", "ME", " ", "support", " ", "multiple", " ", "GPS", "s", " ", "per", " ", "vehic", "le", " ", "-", " ", "possib", "ly", " ", "by", " ", "usi", "ng", " ", "component", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "GPS", "\\u", "RA", "W", "\\u", "INT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "eph", "_", "=_", "m_", "._", "eph", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ep", "v_", "=_", "m_", "._", "ep", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "satellite", "s", "\\u", "visible_", "=_", "m_", "._", "satellite", "s", "\\u", "visible_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "fix", "\\u", "type_", "=_", "m_", "._", "fix", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "gps", "\\u", "0", "'_", ",_", "self_", "._", "gps", "\\u", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "current", "\\u", "waypoint", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "[_", "'", "WAY", "POINT", "\\u", "CURREN", "T", "'_", ",_", "'", "MISSI", "ON", "\\u", "CURREN", "T", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "current", "\\u", "waypoint", "_", "=_", "m_", "._", "seq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "ek", "f", "\\u", "pos", "horiz", "abs_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ek", "f", "\\u", "const", "pos", "mode_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ek", "f", "\\u", "pred", "pos", "horiz", "abs_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "EK", "F", "\\u", "STATUS", "\\u", "REPORT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "boolean", ":", " ", "EK", "F", "'", "s", " ", "horizon", "tal", " ", "position", " ", "(", "abs", "olute", ")", " ", "estimate", " ", "is", " ", "good_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "ek", "f", "\\u", "pos", "horiz", "abs_", "=_", "(_", "m_", "._", "flags_", "&_", "ard", "upi", "lot", "mega", "_", "._", "EK", "F", "\\u", "POS", "\\u", "HORI", "Z", "\\u", "ABS", "_", ")_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "boolean", ":", " ", "EK", "F", " ", "is", " ", "in", " ", "constant", " ", "position", " ", "mode", " ", "and", " ", "doe", "s", " ", "not", " ", "know", " ", "it", "'", "s", " ", "abs", "olute", " ", "or", " ", "relative", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "ek", "f", "\\u", "const", "pos", "mode_", "=_", "(_", "m_", "._", "flags_", "&_", "ard", "upi", "lot", "mega", "_", "._", "EK", "F", "\\u", "CONST", "\\u", "POS", "\\u", "MODE_", ")_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "boolean", ":", " ", "EK", "F", "'", "s", " ", "predi", "cte", "d", " ", "horizon", "tal", " ", "position", " ", "(", "abs", "olute", ")", " ", "estimate", " ", "is", " ", "good_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "ek", "f", "\\u", "pred", "pos", "horiz", "abs_", "=_", "(_", "m_", "._", "flags_", "&_", "ard", "upi", "lot", "mega", "_", "._", "EK", "F", "\\u", "PRE", "D", "\\u", "POS", "\\u", "HORI", "Z", "\\u", "ABS", "_", ")_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "ek", "f", "\\u", "ok", "'_", ",_", "self_", "._", "ek", "f", "\\u", "ok_", ",_", "cache_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "flight", "mode_", "=_", "'", "AUTO", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "arme", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "system", "\\u", "status_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "autop", "ilo", "t", "\\u", "type_", "=_", "None_", "#", "PX", "4", ",", " ", "Ar", "du", "Pilo", "t", ",", " ", "etc", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehic", "le", "\\u", "type_", "=_", "None_", "#", "quad", "cop", "ter", ",", " ", "plane", ",", " ", "etc", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "HEA", "RT", "BEA", "T", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "arme", "d_", "=_", "(_", "m_", "._", "base", "\\u", "mode_", "&_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "MODE", "\\u", "FLAG", "\\u", "SAFE", "TY", "\\u", "ARM", "ED_", ")_", "!=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "arme", "d", "'_", ",_", "self_", "._", "arme", "d_", ",_", "cache_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "autop", "ilo", "t", "\\u", "type_", "=_", "m_", "._", "autop", "ilo", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehic", "le", "\\u", "type_", "=_", "m_", "._", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "mode", "\\u", "available_", "(_", "m_", "._", "custom", "\\u", "mode_", ")_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "API", "Exception_", "(_", "\"", "mode", " ", "%", "s", " ", "not", " ", "avail", "able", " ", "on", " ", "mavlink", " ", "definit", "ion", "\"_", "%_", "m_", "._", "custom", "\\u", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "flight", "mode_", "=_", "self_", "._", "\\u", "mode", "\\u", "mapping", "\\u", "by", "number_", "[_", "m_", "._", "custom", "\\u", "mode_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "mode", "'_", ",_", "self_", "._", "mode_", ",_", "cache_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "system", "\\u", "status_", "=_", "m_", "._", "system", "\\u", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "system", "\\u", "status", "'_", ",_", "self_", "._", "system", "\\u", "status_", ",_", "cache_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Way", "points", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "home", "\\u", "location_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "wp", "loader_", "=_", "mav", "wp_", "._", "MAV", "WP", "Loader_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "wp", "\\u", "loaded_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "wp", "\\u", "uploade", "d_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "wpt", "s", "\\u", "dirty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "commands_", "=_", "Command", "Sequence_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "[_", "'", "WAY", "POINT", "\\u", "COUNT", "'_", ",_", "'", "MISSI", "ON", "\\u", "COUNT", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "wp", "\\u", "loaded_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "wp", "loader_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "wp", "loader_", "._", "expected", "\\u", "count_", "=_", "msg_", "._", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "master_", "._", "waypoint", "\\u", "request", "\\u", "send_", "(_", "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_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "[_", "'", "WAY", "POINT", "'_", ",_", "'", "MISSI", "ON", "\\u", "ITEM", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "wp", "\\u", "loaded_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "msg_", "._", "seq_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "(_", "msg_", "._", "x_", "==_", "0_", "and_", "msg_", "._", "y_", "==_", "0_", "and_", "msg_", "._", "z_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "home", "\\u", "location_", "=_", "Locat", "ion", "Global_", "(_", "msg_", "._", "x_", ",_", "msg_", "._", "y_", ",_", "msg_", "._", "z_", ")_", "\\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_", "msg_", "._", "seq_", ">_", "self_", "._", "\\u", "wp", "loader_", "._", "count_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Une", "xpe", "cte", "d", " ", "waypoint", "_", "\\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_", "elif_", "msg_", "._", "seq_", "<_", "self_", "._", "\\u", "wp", "loader_", "._", "count_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Way", "point", " ", "duplicate_", "\\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 ", " ", "_", "self_", "._", "\\u", "wp", "loader_", "._", "add_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "msg_", "._", "seq_", "+_", "1_", "<_", "self_", "._", "\\u", "wp", "loader_", "._", "expected", "\\u", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "master_", "._", "waypoint", "\\u", "request", "\\u", "send_", "(_", "msg_", "._", "seq_", "+_", "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", "wp", "\\u", "loaded_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "command", "s", "'_", ",_", "self_", "._", "commands_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Way", "point", " ", "send", " ", "to", " ", "master_", "\\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_", "._", "on", "\\u", "message_", "(_", "[_", "'", "WAY", "POINT", "\\u", "REQUEST", "'_", ",_", "'", "MISSI", "ON", "\\u", "REQUEST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "wp", "\\u", "uploade", "d_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wp_", "=_", "self_", "._", "\\u", "wp", "loader_", "._", "wp_", "(_", "msg_", "._", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "fix", "\\u", "targets_", "(_", "wp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "master_", "._", "mav_", "._", "send_", "(_", "wp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "wp", "\\u", "uploade", "d_", "[_", "msg_", "._", "seq_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Way", "point", " ", "loop", " ", "listeners_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Parameter", "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_", "start", "\\u", "duration_", "=_", "0.2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repeat", "\\u", "duration_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "count_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "set_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "loaded_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "start_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "last_", "=_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "#", " ", "Las", "t", " ", "new", " ", "param", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "duration_", "=_", "start", "\\u", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "parameters_", "=_", "Parameters_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "handler_", "._", "forward", "\\u", "loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "time", " ", "duration", " ", "for", " ", "last", " ", "\"", "new", "\"", " ", "params", " ", "exceed", "s", " ", "watchdog", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "params", "\\u", "start_", ":_", "\\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_", "None_", "not_", "in_", "self_", "._", "\\u", "params", "\\u", "set_", "and_", "not_", "self_", "._", "\\u", "params", "\\u", "loaded_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "params", "\\u", "loaded_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "parameter", "s", "'_", ",_", "self_", "._", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "params", "\\u", "loaded_", "and_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "-_", "self_", "._", "\\u", "params", "\\u", "last_", ">_", "self_", "._", "\\u", "params", "\\u", "duration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "v_", "in_", "enumerate_", "(_", "self_", "._", "\\u", "params", "\\u", "set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "v_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "master_", "._", "mav_", "._", "param", "\\u", "request", "\\u", "read", "\\u", "send_", "(_", "0_", ",_", "0_", ",_", "''_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", ">_", "50_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "duration_", "=_", "repeat", "\\u", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "last_", "=_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "\\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_", "._", "on", "\\u", "message_", "(_", "[_", "'", "PARAM", "\\u", "VALU", "E", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "discove", "r", " ", "a", " ", "new", " ", "param", " ", "count", ",", " ", "assume", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "receiv", "ing", " ", "a", " ", "new", " ", "param", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "params", "\\u", "count_", "!=_", "msg_", "._", "param", "\\u", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "params", "\\u", "loaded_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "start_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "count_", "=_", "msg_", "._", "param", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "set_", "=_", "[_", "None_", "]_", "*_", "msg_", "._", "param", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Atte", "mpt", " ", "to", " ", "set", " ", "the", " ", "params", ".", " ", "We", " ", "throw", " ", "an", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "index", " ", "is", " ", "out", " ", "of", " ", "range", " ", "of", " ", "the", " ", "count", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "lack", " ", "a", " ", "param", "\\u", "id", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "msg_", "._", "param", "\\u", "index_", "<_", "msg_", "._", "param", "\\u", "count_", "and_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "\\u", "params", "\\u", "set_", "[_", "msg_", "._", "param", "\\u", "index_", "]_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "params", "\\u", "last_", "=_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "duration_", "=_", "start", "\\u", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "set_", "[_", "msg_", "._", "param", "\\u", "index_", "]_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "map_", "[_", "msg_", "._", "param", "\\u", "id_", "]_", "=_", "msg_", "._", "param", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "parameters_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "msg_", "._", "param", "\\u", "id_", ",_", "msg_", "._", "param", "\\u", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "=_", "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 ", " _", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Heart", "beats", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "started_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "lasts", "ent_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "lastr", "ece", "ive", "d_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "timeout_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "warning_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "error_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "system_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "handler_", "._", "forward", "\\u", "loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sen", "d", " ", "1", " ", "heart", "beat", " ", "per", " ", "second_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "-_", "self_", "._", "\\u", "heart", "beat", "\\u", "lasts", "ent_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "master_", "._", "mav_", "._", "heart", "beat", "\\u", "send_", "(_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "TYPE", "\\u", "GC", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "AUTO", "PI", "LOT", "\\u", "INVALID", "_", ",_", "0_", ",_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "lasts", "ent_", "=_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Time", "outs", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "heart", "beat", "\\u", "started_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "heart", "beat", "\\u", "error_", "and_", "self_", "._", "\\u", "heart", "beat", "\\u", "error_", ">_", "0_", "and_", "monotonic", "_", "._", "monotonic", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "-_", "self_", "._", "\\u", "heart", "beat", "\\u", "lastr", "ece", "ive", "d_", ">_", "self_", "._", "\\u", "heart", "beat", "\\u", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "API", "Exception_", "(_", "'", "No", " ", "heart", "beat", " ", "in", " ", "%", "s", " ", "second", "s", ",", " ", "abort", "ing", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "-_", "self_", "._", "\\u", "heart", "beat", "\\u", "lastr", "ece", "ive", "d_", ">_", "self_", "._", "\\u", "heart", "beat", "\\u", "warning_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "\\u", "heart", "beat", "\\u", "timeout_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "err", "printer_", "(_", "'>>", ">", " ", "Link", " ", "timeo", "ut", ",", " ", "no", " ", "heart", "beat", " ", "in", " ", "last", " ", "%", "s", " ", "second", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "timeout_", "=_", "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_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "[_", "'", "HEA", "RT", "BEA", "T", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "heart", "beat", "\\u", "system_", "=_", "msg_", "._", "get", "\\u", "src", "System_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "lastr", "ece", "ive", "d_", "=_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "heart", "beat", "\\u", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "printer_", "(_", "'>>", ">", " ", "...", "link", " ", "restore", "d", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "timeout_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "last", "\\u", "heartbeat_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "handler_", "._", "forward", "\\u", "loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "heart", "beat", "\\u", "lastr", "ece", "ive", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "last", "\\u", "heartbeat_", "=_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "-_", "self_", "._", "\\u", "heart", "beat", "\\u", "lastr", "ece", "ive", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "last", "\\u", "heart", "beat", "'_", ",_", "self_", "._", "last", "\\u", "heartbeat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\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_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "last", "\\u", "heartbeat_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Time", " ", "sinc", "e", " ", "last", " ", "MAV", "Link", " ", "heart", "beat", " ", "was", " ", "receive", "d", " ", "(", "in", " ", "second", "s", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "attribute", " ", "can", " ", "be", " ", "used", " ", "to", " ", "monit", "or", " ", "link", " ", "activit", "y", " ", "and", " ", "implement", " ", "script", "-", "specific", " ", "timeo", "ut", " ", "handling", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "to", " ", "paus", "e", " ", "the", " ", "script", " ", "if", " ", "no", " ", "heart", "beat", " ", "is", " ", "receive", "d", " ", "for", " ", "more", " ", "than", " ", "1", " ", "second", " ", "you", " ", "mig", "ht", " ", "implement", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "follow", "ing", " ", "observer", ",", " ", "and", " ", "use", " ", "``", "paus", "e\\u", "script", "``", " ", "in", " ", "a", " ", "program", " ", "loop", " ", "to", " ", "wait", " ", "unti", "l", " ", "the", " ", "link", " ", "is", " ", "recovered", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "paus", "e\\u", "script", "=", "Fal", "se", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "vehic", "le", ".", "on", "\\u", "attribute", "('", "last", "\\u", "heart", "beat", "')", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "listen", "er", "(", "self", ",", " ", "attr", "\\u", "name", ",", " ", "value", "):", "\\", "10", ";", " ", " ", " ", " ", "global", " ", "paus", "e\\u", "script", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "value", " ", ">", " ", "1", " ", "and", " ", "not", " ", "paus", "e\\u", "script", ":", "\\", "10", ";", " ", " ", "print", " ", "\"", "Pa", "usi", "ng", " ", "script", " ", "due", " ", "to", " ", "bad", " ", "link", "\"", "\\", "10", ";", " ", " ", "paus", "e\\u", "script", "=", "Tru", "e", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "value", " ", "<", " ", "1", " ", "and", " ", "paus", "e\\u", "script", ":", "\\", "10", ";", " ", " ", "paus", "e\\u", "script", "=", "Fal", "se", ";", "\\", "10", ";", " ", " ", "print", " ", "\"", "Un", "-", "paus", "ing", " ", "script", "\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "observer", " ", "will", " ", "be", " ", "call", "ed", " ", "at", " ", "the", " ", "period", " ", "of", " ", "the", " ", "mess", "agin", "g", " ", "loop", " ", "(", "abo", "ut", " ", "every", " ", "0.01", " ", "second", "s", ").", " ", "Test", "ing", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "SIT", "L", " ", "indicat", "es", " ", "tha", "t", " ", "``", "last", "\\u", "heart", "beat", "``", " ", "averages", " ", "abo", "ut", " ", ".5", " ", "second", "s", ",", " ", "but", " ", "will", " ", "rare", "ly", " ", "exceed", " ", "1.5", " ", "second", "s", "\\", "10", ";", " ", " ", " ", " ", "whe", "n", " ", "connect", "ed", ".", " ", "Whe", "ther", " ", "heart", "beat", " ", "monitorin", "g", " ", "can", " ", "be", " ", "usef", "ul", " ", "will", " ", "very", " ", "muc", "h", " ", "depend", " ", "on", " ", "the", " ", "applica", "tion", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "you", " ", "just", " ", "want", " ", "to", " ", "change", " ", "the", " ", "heart", "beat", " ", "timeo", "ut", " ", "you", " ", "can", " ", "modif", "y", " ", "the", " ", "``", "heart", "beat", "\\u", "timeo", "ut", "``", "\\", "10", ";", " ", " ", " ", " ", "parameter", " ", "pass", "ed", " ", "to", " ", "the", " ", ":", "py", ":", "func", ":`", "connect", "()", " ", "<", "drone", "kit", ".", "connect", ">`", " ", "function", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "last", "\\u", "heartbeat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "message_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Decorat", "or", " ", "for", " ", "message", " ", "listen", "er", " ", "callback", " ", "function", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "tip", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "most", " ", "ele", "gan", "t", " ", "way", " ", "to", " ", "defin", "e", " ", "message", " ", "listen", "er", " ", "callback", " ", "function", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", ":", "py", ":", "func", ":`", "add", "\\u", "message", "\\u", "listen", "er", "`", " ", "only", " ", "if", " ", "you", " ", "need", " ", "to", " ", "be", " ", "able", " ", "to", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "func", ":`", "remove", " ", "the", " ", "listen", "er", " ", "<", "remove", "\\u", "message", "\\u", "listen", "er", ">`", " ", "late", "r", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "decorated", " ", "message", " ", "listen", "er", " ", "function", " ", "is", " ", "call", "ed", " ", "with", " ", "three", " ", "argu", "ment", "s", " ", "every", " ", "time", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "specified", " ", "message", " ", "is", " ", "receive", "d", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "self", "``", " ", "-", " ", "the", " ", "current", " ", "vehic", "le", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "name", "``", " ", "-", " ", "the", " ", "name", " ", "of", " ", "the", " ", "message", " ", "tha", "t", " ", "was", " ", "intercept", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "message", "``", " ", "-", " ", "the", " ", "actual", " ", "message", " ", "(", "a", " ", "`", "pyma", "vlin", "k", " ", "<", "http", "://", "www", ".", "qg", "round", "control", ".", "org", "/", "mavlink", "/", "pyma", "vlin", "k", ">`\\u", "\\", "10", ";", " ", " ", "`", "class", " ", "<", "https", "://", "www", ".", "samba", ".", "org", "/", "trid", "ge", "/", "UA", "V", "/", "pyma", "vlin", "k", "/", "apid", "ocs", "/", "class", "Index", ".", "html", ">`\\u", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "in", " ", "the", " ", "fragment", " ", "belo", "w", " ", "``", "my", "\\u", "method", "``", " ", "will", " ", "be", " ", "call", "ed", " ", "for", " ", "every", " ", "heart", "beat", " ", "message", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "vehic", "le", ".", "on", "\\u", "message", "('", "HEA", "RT", "BEA", "T", "')", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "my", "\\u", "method", "(", "self", ",", " ", "name", ",", " ", "msg", "):", "\\", "10", ";", " ", " ", " ", " ", "pass", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", ":", "ref", ":`", "mavlink", "\\u", "message", "s", "`", " ", "for", " ", "more", " ", "informati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "String", " ", "name", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "message", " ", "to", " ", "be", " ", "intercept", "ed", " ", "by", " ", "the", " ", "decorated", " ", "listen", "er", " ", "function", " ", "(", "or", " ", "'*", "'", " ", "to", " ", "get", " ", "all", " ", "message", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\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 ", " _", "if_", "isinstance_", "(_", "name_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "n_", "in_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "add", "\\u", "message", "\\u", "listener_", "(_", "n_", ",_", "fn_", ")_", "\\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_", "._", "add", "\\u", "message", "\\u", "listener_", "(_", "name_", ",_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decorator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "message", "\\u", "listener_", "(_", "self_", ",_", "name_", ",_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", "s", " ", "a", " ", "message", " ", "listen", "er", " ", "function", " ", "tha", "t", " ", "will", " ", "be", " ", "call", "ed", " ", "every", " ", "time", " ", "the", " ", "specified", " ", "message", " ", "is", " ", "receive", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "tip", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "recommend", " ", "you", " ", "use", " ", ":", "py", ":", "func", ":`", "on", "\\u", "message", "`", " ", "inst", "ead", " ", "of", " ", "this", " ", "method", " ", "as", " ", "it", " ", "has", " ", "a", " ", "more", " ", "ele", "gan", "t", " ", "synta", "x", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "only", " ", "prefer", "red", " ", "if", " ", "you", " ", "need", " ", "to", " ", "be", " ", "able", " ", "to", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "func", ":`", "remove", " ", "the", " ", "listen", "er", " ", "<", "remove", "\\u", "message", "\\u", "listen", "er", ">`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "callback", " ", "function", " ", "must", " ", "have", " ", "three", " ", "argu", "ment", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "self", "``", " ", "-", " ", "the", " ", "current", " ", "vehic", "le", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "name", "``", " ", "-", " ", "the", " ", "name", " ", "of", " ", "the", " ", "message", " ", "tha", "t", " ", "was", " ", "intercept", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "message", "``", " ", "-", " ", "the", " ", "actual", " ", "message", " ", "(", "a", " ", "`", "pyma", "vlin", "k", " ", "<", "http", "://", "www", ".", "qg", "round", "control", ".", "org", "/", "mavlink", "/", "pyma", "vlin", "k", ">`\\u", "\\", "10", ";", " ", " ", "`", "class", " ", "<", "https", "://", "www", ".", "samba", ".", "org", "/", "trid", "ge", "/", "UA", "V", "/", "pyma", "vlin", "k", "/", "apid", "ocs", "/", "class", "Index", ".", "html", ">`\\u", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "in", " ", "the", " ", "fragment", " ", "belo", "w", " ", "``", "my", "\\u", "method", "``", " ", "will", " ", "be", " ", "call", "ed", " ", "for", " ", "every", " ", "heart", "beat", " ", "message", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "Call", "back", " ", "method", " ", "for", " ", "new", " ", "message", "s", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "my", "\\u", "method", "(", "self", ",", " ", "name", ",", " ", "msg", "):", "\\", "10", ";", " ", " ", " ", " ", "pass", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "add", "\\u", "message", "\\u", "listen", "er", "('", "HEA", "RT", "BEA", "T", "',", "my", "\\u", "method", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", ":", "ref", ":`", "mavlink", "\\u", "message", "s", "`", " ", "for", " ", "more", " ", "informati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "String", " ", "name", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "message", " ", "to", " ", "be", " ", "intercept", "ed", " ", "by", " ", "the", " ", "listen", "er", " ", "function", " ", "(", "or", " ", "'*", "'", " ", "to", " ", "get", " ", "all", " ", "message", "s", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "fn", ":", " ", "The", " ", "listen", "er", " ", "function", " ", "tha", "t", " ", "will", " ", "be", " ", "call", "ed", " ", "if", " ", "a", " ", "message", " ", "is", " ", "receive", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "str_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "not_", "in_", "self_", "._", "\\u", "message", "\\u", "listeners_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "message", "\\u", "listeners_", "[_", "name_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fn_", "not_", "in_", "self_", "._", "\\u", "message", "\\u", "listeners_", "[_", "name_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "message", "\\u", "listeners_", "[_", "name_", "]_", "._", "append_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "message", "\\u", "listener_", "(_", "self_", ",_", "name_", ",_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Remove", "s", " ", "a", " ", "message", " ", "listen", "er", " ", "(", "tha", "t", " ", "was", " ", "previ", "ously", " ", "adde", "d", " ", "usi", "ng", " ", ":", "py", ":", "func", ":`", "add", "\\u", "message", "\\u", "listen", "er", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", ":", "ref", ":`", "mavlink", "\\u", "message", "s", "`", " ", "for", " ", "more", " ", "informati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "String", " ", "name", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "message", " ", "for", " ", "whi", "ch", " ", "the", " ", "listen", "er", " ", "is", " ", "to", " ", "be", " ", "remove", "d", " ", "(", "or", " ", "'*", "'", " ", "to", " ", "remove", " ", "an", " ", "'", "all", " ", "message", "s", "'", " ", "observer", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "fn", ":", " ", "The", " ", "listen", "er", " ", "callback", " ", "function", " ", "to", " ", "remove", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "str_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "in_", "self_", "._", "\\u", "message", "\\u", "listeners_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fn_", "in_", "self_", "._", "\\u", "message", "\\u", "listeners_", "[_", "name_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "message", "\\u", "listeners_", "[_", "name_", "]_", "._", "remove_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "\\u", "message", "\\u", "listeners_", "[_", "name_", "]_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "self_", "._", "\\u", "message", "\\u", "listeners_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\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_", "notif", "y", "\\u", "message", "\\u", "listeners_", "(_", "self_", ",_", "name_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "fn_", "in_", "self_", "._", "\\u", "message", "\\u", "listeners_", "._", "get_", "(_", "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 ", " _", "fn_", "(_", "self_", ",_", "name_", ",_", "msg_", ")_", "\\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 ", " _", "err", "printer_", "(_", "'>>", ">", " ", "Except", "ion", " ", "in", " ", "message", " ", "handler", " ", "for", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "._", "get", "\\u", "type_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "printer_", "(_", "'>>", ">", " ", "'_", "+_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "fn_", "in_", "self_", "._", "\\u", "message", "\\u", "listeners_", "._", "get_", "(_", "'*'_", ",_", "[_", "]_", ")_", ":_", "\\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 ", " _", "fn_", "(_", "self_", ",_", "name_", ",_", "msg_", ")_", "\\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 ", " _", "err", "printer_", "(_", "'>>", ">", " ", "Except", "ion", " ", "in", " ", "message", " ", "handler", " ", "for", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "._", "get", "\\u", "type_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "printer_", "(_", "'>>", ">", " ", "'_", "+_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\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_", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "handler_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "flush_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Call", " ", "``", "flush", "()``", " ", "after", " ", ":", "py", ":", "func", ":`", "addin", "g", " ", "<", "Command", "Sequ", "ence", ".", "add", ">`", " ", "or", " ", ":", "py", ":", "func", ":`", "clear", "ing", " ", "<", "Command", "Sequ", "ence", ".", "clear", ">`", " ", "missio", "n", " ", "command", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Af", "ter", " ", "the", " ", "return", " ", "from", " ", "``", "flush", "()``", " ", "any", " ", "writes", " ", "are", " ", "guaran", "tee", "d", " ", "to", " ", "have", " ", "complete", "d", " ", "(", "or", " ", "throw", "n", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "exception", ")", " ", "and", " ", "future", " ", "reads", " ", "will", " ", "see", " ", "thei", "r", " ", "effect", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "warn", "ing", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "depre", "cated", ".", " ", "It", " ", "has", " ", "bee", "n", " ", "replaced", " ", "by", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "func", ":`", "Vehicle", ".", "command", "s", ".", "upload", "()", " ", "<", "Vehicle", ".", "command", "s", ".", "upload", ">`", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "commands_", "._", "upload_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "mode", "\\u", "mapping_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "master_", "._", "mode", "\\u", "mapping_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "mode", "\\u", "mapping", "\\u", "by", "number_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mav", "util_", "._", "mode", "\\u", "mapping", "\\u", "by", "number_", "(_", "self_", "._", "\\u", "vehic", "le", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "is", "\\u", "mode", "\\u", "available_", "(_", "self_", ",_", "mode", "\\u", "code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mode", "\\u", "code_", "in_", "self_", "._", "\\u", "mode", "\\u", "mapping", "\\u", "by", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "mode_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "attribute", " ", "is", " ", "used", " ", "to", " ", "get", " ", "and", " ", "set", " ", "the", " ", "current", " ", "flight", " ", "mode", " ", "(:", "py", ":", "class", ":`", "Vehicle", "Mode", "`)", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "flight", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Vehicle", "Mode_", "(_", "self_", "._", "\\u", "flight", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mode_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "mode_", "(_", "self_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "master_", "._", "set\\u", "mode_", "(_", "self_", "._", "\\u", "mode", "\\u", "mapping_", "[_", "v_", "._", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "location_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "vehic", "le", " ", "location", " ", "in", " ", "global", ",", " ", "global", " ", "relative", " ", "and", " ", "local", " ", "frames", " ", "(:", "py", ":", "class", ":`", "Locat", "ion", "s", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "different", " ", "frames", " ", "are", " ", "accesse", "d", " ", "through", " ", "its", " ", "member", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", ":", "py", ":", "attr", ":`", "global", "\\u", "frame", " ", "<", "drone", "kit", ".", "Locat", "ion", "s", ".", "global", "\\u", "frame", ">`", " ", "(:", "py", ":", "class", ":`", "Locat", "ion", "Global", "`)", "\\", "10", ";", " ", " ", " ", " ", "*", " ", ":", "py", ":", "attr", ":`", "global", "\\u", "relative", "\\u", "frame", " ", "<", "drone", "kit", ".", "Locat", "ion", "s", ".", "global", "\\u", "relative", "\\u", "frame", ">`", " ", "(:", "py", ":", "class", ":`", "Locat", "ion", "Global", "Relative", "`)", "\\", "10", ";", " ", " ", " ", " ", "*", " ", ":", "py", ":", "attr", ":`", "local", "\\u", "frame", " ", "<", "drone", "kit", ".", "Locat", "ion", "s", ".", "local", "\\u", "frame", ">`", " ", "(:", "py", ":", "class", ":`", "Locat", "ion", "Local", "`)", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "to", " ", "print", " ", "the", " ", "location", " ", "in", " ", "each", " ", "frame", " ", "for", " ", "a", " ", "``", "vehic", "le", "``", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Print", " ", "location", " ", "informati", "on", " ", "for", " ", "`", "vehic", "le", "`", " ", "in", " ", "all", " ", "frames", " ", "(", "default", " ", "printer", ")", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Global", " ", "Locat", "ion", ":", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "location", ".", "global", "\\u", "frame", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Global", " ", "Locat", "ion", " ", "(", "relative", " ", "alti", "tude", "):", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "location", ".", "global", "\\u", "relative", "\\u", "frame", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Local", " ", "Locat", "ion", ":", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "location", ".", "local", "\\u", "frame", " ", " ", " ", " ", "#", "NED", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Print", " ", "alti", "tude", "s", " ", "in", " ", "the", " ", "different", " ", "frames", " ", "(", "see", " ", "class", " ", "definit", "ion", "s", " ", "for", " ", "other", " ", "avail", "able", " ", "informati", "on", ")", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Alt", "itu", "de", " ", "(", "global", " ", "frame", "):", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "location", ".", "global", "\\u", "frame", ".", "alt", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Alt", "itu", "de", " ", "(", "global", " ", "relative", " ", "frame", "):", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "location", ".", "global", "\\u", "relative", "\\u", "frame", ".", "alt", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Alt", "itu", "de", " ", "(", "NED", " ", "frame", "):", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "location", ".", "local", "\\u", "frame", ".", "down", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "the", " ", "location", " ", "\"", "values", "\"", " ", "(", "e", ".", "g", ".", " ", "``", "global", "\\u", "frame", ".", "lat", "``)", " ", "are", " ", "initially", "\\", "10", ";", " ", " ", " ", " ", "created", " ", "with", " ", "value", " ", "``", "Non", "e", "``.", " ", "The", " ", "``", "global", "\\u", "frame", "``", ",", " ", "``", "global", "\\u", "relative", "\\u", "frame", "``", "\\", "10", ";", " ", " ", " ", " ", "latitude", " ", "and", " ", "longitude", " ", "values", " ", "are", " ", "populate", "d", " ", "short", "ly", " ", "after", " ", "initiali", "sation", " ", "but", "\\", "10", ";", " ", " ", " ", " ", "``", "global", "\\u", "frame", ".", "alt", "``", " ", "may", " ", "take", " ", "a", " ", "few", " ", "second", "s", " ", "long", "er", " ", "to", " ", "be", " ", "update", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "``", "local", "\\u", "frame", "``", " ", "doe", "s", " ", "not", " ", "populate", " ", "unti", "l", " ", "the", " ", "vehic", "le", " ", "is", " ", "arme", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "attribute", " ", "and", " ", "its", " ", "member", "s", " ", "are", " ", "observable", ".", " ", "To", " ", "watch", " ", "for", " ", "change", "s", " ", "in", " ", "all", " ", "frames", " ", "usi", "ng", " ", "a", " ", "listen", "er", "\\", "10", ";", " ", " ", " ", " ", "created", " ", "usi", "ng", " ", "a", " ", "decorat", "or", " ", "(", "you", " ", "can", " ", "als", "o", " ", "defin", "e", " ", "a", " ", "listen", "er", " ", "and", " ", "explicit", "ly", " ", "add", " ", "it", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "vehic", "le", ".", "on", "\\u", "attribute", "('", "location", "')", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "listen", "er", "(", "self", ",", " ", "attr", "\\u", "name", ",", " ", "value", "):", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "`", "self", "`", ":", " ", ":", "py", ":", "class", ":`", "Vehicle", "`", " ", "object", " ", "tha", "t", " ", "has", " ", "bee", "n", " ", "update", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "`", "attr", "\\u", "name", "`", ":", " ", "name", " ", "of", " ", "the", " ", "observe", "d", " ", "attribute", " ", "-", " ", "'", "location", "'", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "`", "value", "`", " ", "is", " ", "the", " ", "update", "d", " ", "attribute", " ", "value", " ", "(", "a", " ", ":", "py", ":", "class", ":`", "Locat", "ion", "s", "`)", ".", " ", "Thi", "s", " ", "can", " ", "be", " ", "queried", " ", "for", " ", "the", " ", "frame", " ", "informati", "on", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", " ", "Global", ":", " ", "%", "s", "\"", " ", "%", " ", "value", ".", "global", "\\u", "frame", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", " ", "Global", "Relative", ":", " ", "%", "s", "\"", " ", "%", " ", "value", ".", "global", "\\u", "relative", "\\u", "frame", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", " ", "Local", ":", " ", "%", "s", "\"", " ", "%", " ", "value", ".", "local", "\\u", "frame", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "watch", " ", "for", " ", "change", "s", " ", "in", " ", "just", " ", "one", " ", "attribute", " ", "(", "in", " ", "this", " ", "case", " ", "``", "global", "\\u", "frame", "``)", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "vehic", "le", ".", "on", "\\u", "attribute", "('", "location", ".", "global", "\\u", "frame", "')", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "listen", "er", "(", "self", ",", " ", "attr", "\\u", "name", ",", " ", "value", "):", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "`", "self", "`", ":", " ", ":", "py", ":", "class", ":`", "Locat", "ion", "s", "`", " ", "object", " ", "tha", "t", " ", "has", " ", "bee", "n", " ", "update", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "`", "attr", "\\u", "name", "`", ":", " ", "name", " ", "of", " ", "the", " ", "observe", "d", " ", "attribute", " ", "-", " ", "'", "global", "\\u", "frame", "'", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "`", "value", "`", " ", "is", " ", "the", " ", "update", "d", " ", "attribute", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", " ", "Global", ":", " ", "%", "s", "\"", " ", "%", " ", "value", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "Or", " ", "watch", " ", "usi", "ng", " ", "decorat", "or", ":", " ", "``", "@", "vehic", "le", ".", "location", ".", "on", "\\u", "attribute", "('", "global", "\\u", "frame", "')", "``.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "battery", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Curr", "ent", " ", "system", " ", "batt", "er", " ", "status", " ", "(:", "py", ":", "class", ":`", "Batt", "ery", "`)", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "voltage_", "==_", "None_", "or_", "self_", "._", "\\u", "current_", "==_", "None_", "or_", "self_", "._", "\\u", "level_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Batt", "ery", "_", "(_", "self_", "._", "\\u", "voltage_", ",_", "self_", "._", "\\u", "current_", ",_", "self_", "._", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "range", "finder_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Range", "finde", "r", " ", "distance", " ", "and", " ", "voltage", " ", "values", " ", "(:", "py", ":", "class", ":`", "Range", "finde", "r", "`)", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Range", "finder_", "(_", "self_", "._", "\\u", "rng", "fn", "d\\u", "distance_", ",_", "self_", "._", "\\u", "rng", "fn", "d\\u", "voltage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "velocity_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Curr", "ent", " ", "velo", "city", " ", "as", " ", "a", " ", "three", " ", "element", " ", "list", " ", "``[", " ", "vx", ",", " ", "vy", ",", " ", "vz", " ", "]``", " ", "(", "in", " ", "mete", "r", "/", "sec", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "self_", "._", "\\u", "vx_", ",_", "self_", "._", "\\u", "vy_", ",_", "self_", "._", "\\u", "vz", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "autop", "ilo", "t", " ", "version", " ", "and", " ", "type", " ", "in", " ", "a", " ", ":", "py", ":", "class", ":`", "Version", "`", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "2.0", ".3", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Version_", "(_", "self_", "._", "\\u", "raw", "\\u", "version_", ",_", "self_", "._", "\\u", "autop", "ilo", "t", "\\u", "type_", ",_", "self_", "._", "\\u", "vehic", "le", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "capabilities_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "autop", "ilo", "t", " ", "capab", "ilities", " ", "in", " ", "a", " ", ":", "py", ":", "class", ":`", "Capabilities", "`", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "2.0", ".3", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Capabilities", "_", "(_", "self_", "._", "\\u", "capabilities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "atti", "tude", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Curr", "ent", " ", "vehic", "le", " ", "atti", "tude", " ", "-", " ", "pitch", ",", " ", "yaw", ",", " ", "roll", " ", "(:", "py", ":", "class", ":`", "Att", "itu", "de", "`)", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Att", "itude_", "(_", "self_", "._", "\\u", "pitch_", ",_", "self_", "._", "\\u", "yaw_", ",_", "self_", "._", "\\u", "roll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "gps", "\\u", "0_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "GPS", " ", "position", " ", "informati", "on", " ", "(:", "py", ":", "class", ":`", "GPS", "Info", "`)", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "GPS", "Info_", "(_", "self_", "._", "\\u", "eph", "_", ",_", "self_", "._", "\\u", "ep", "v_", ",_", "self_", "._", "\\u", "fix", "\\u", "type_", ",_", "self_", "._", "\\u", "satellite", "s", "\\u", "visible_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "arme", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "attribute", " ", "can", " ", "be", " ", "used", " ", "to", " ", "get", " ", "and", " ", "set", " ", "the", " ", "``", "arme", "d", "``", " ", "state", " ", "of", " ", "the", " ", "vehic", "le", " ", "(", "``", "boolean", "``)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "code", " ", "belo", "w", " ", "show", "s", " ", "how", " ", "to", " ", "read", " ", "the", " ", "state", ",", " ", "and", " ", "to", " ", "arm", "/", "disa", "rm", " ", "the", " ", "vehic", "le", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Print", " ", "the", " ", "arme", "d", " ", "state", " ", "for", " ", "the", " ", "vehic", "le", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Arm", "ed", ":", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "arme", "d", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Disa", "rm", " ", "the", " ", "vehic", "le", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "arme", "d", " ", "=", " ", "Fal", "se", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Arm", " ", "the", " ", "vehic", "le", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "arme", "d", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "arme", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "arme", "d_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "arme", "d_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "bool_", "(_", "value_", ")_", "!=_", "self_", "._", "\\u", "arme", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "master_", "._", "ard", "uco", "pte", "r", "\\u", "arm_", "(_", ")_", "\\u\\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", "master_", "._", "ard", "uco", "pte", "r", "\\u", "disa", "rm_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\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_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "is", "\\u", "arma", "ble_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "``", "Tru", "e", "``", " ", "if", " ", "the", " ", "vehic", "le", " ", "is", " ", "read", "y", " ", "to", " ", "arm", ",", " ", "fal", "se", " ", "other", "wis", "e", " ", "(", "``", "Boo", "lean", "``)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "attribute", " ", "wrap", "s", " ", "a", " ", "number", " ", "of", " ", "pre", "-", "arm", " ", "checks", ",", " ", "ens", "uri", "ng", " ", "tha", "t", " ", "the", " ", "vehic", "le", " ", "has", " ", "boot", "ed", ",", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "a", " ", "good", " ", "GPS", " ", "fix", ",", " ", "and", " ", "tha", "t", " ", "the", " ", "EK", "F", " ", "pre", "-", "arm", " ", "is", " ", "complete", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "tha", "t", " ", "mode", " ", "is", " ", "not", " ", "INITIAL", "SIN", "G_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "tha", "t", " ", "we", " ", "have", " ", "a", " ", "GPS", " ", "fix_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "tha", "t", " ", "EK", "F", " ", "pre", "-", "arm", " ", "is", " ", "complete_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "mode_", "!=_", "'", "INITIAL", "ISI", "NG", "'_", "and_", "self_", "._", "gps", "\\u", "0_", "._", "fix", "\\u", "type_", ">_", "1_", "and_", "self_", "._", "\\u", "ek", "f", "\\u", "pred", "pos", "horiz", "abs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "system", "\\u", "status_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "System", " ", "status", " ", "(:", "py", ":", "class", ":`", "System", "Status", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "status", " ", "has", " ", "a", " ", "``", "state", "``", " ", "property", " ", "with", " ", "one", " ", "of", " ", "the", " ", "follow", "ing", " ", "values", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "UNI", "NIT", "``", ":", " ", "Unin", "itialized", " ", "system", ",", " ", "state", " ", "is", " ", "unknown", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "BOOT", "``", ":", " ", "System", " ", "is", " ", "boot", "ing", " ", "up", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "CALI", "BRA", "TIN", "G", "``", ":", " ", "System", " ", "is", " ", "calibra", "ting", " ", "and", " ", "not", " ", "flight", "-", "read", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "STAN", "DB", "Y", "``", ":", " ", "System", " ", "is", " ", "ground", "ed", " ", "and", " ", "on", " ", "standby", ".", " ", "It", " ", "can", " ", "be", " ", "launched", " ", "any", " ", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "ACTI", "VE", "``", ":", " ", "System", " ", "is", " ", "active", " ", "and", " ", "mig", "ht", " ", "be", " ", "alr", "ead", "y", " ", "air", "born", "e", ".", " ", "Moto", "rs", " ", "are", " ", "engage", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "CRIT", "ICAL", "``", ":", " ", "System", " ", "is", " ", "in", " ", "a", " ", "non", "-", "normal", " ", "flight", " ", "mode", ".", " ", "It", " ", "can", " ", "how", "ever", " ", "still", " ", "navigate", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "EME", "RG", "ENC", "Y", "``", ":", " ", "System", " ", "is", " ", "in", " ", "a", " ", "non", "-", "normal", " ", "flight", " ", "mode", ".", " ", "It", " ", "lost", " ", "control", " ", "over", " ", "part", "s", "\\", "10", ";", " ", " ", "or", " ", "over", " ", "the", " ", "whole", " ", "airf", "rame", ".", " ", "It", " ", "is", " ", "in", " ", "may", "day", " ", "and", " ", "goi", "ng", " ", "down", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "POWER", "OFF", "``", ":", " ", "System", " ", "just", " ", "initialize", "d", " ", "its", " ", "power", "-", "down", " ", "sequence", ",", " ", "will", " ", "shut", " ", "down", " ", "now", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "System", "Status_", "(_", "'", "UNI", "NIT", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "System", "Status_", "(_", "'", "BOOT", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "System", "Status_", "(_", "'", "CALI", "BRA", "TIN", "G", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "System", "Status_", "(_", "'", "STAN", "DB", "Y", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "System", "Status_", "(_", "'", "ACTI", "VE", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ":_", "System", "Status_", "(_", "'", "CRIT", "ICAL", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "6_", ":_", "System", "Status_", "(_", "'", "EME", "RG", "ENC", "Y", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "7_", ":_", "System", "Status_", "(_", "'", "POWER", "OFF", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "._", "get_", "(_", "self_", "._", "\\u", "system", "\\u", "status_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "heading_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Curr", "ent", " ", "heading", " ", "in", " ", "degr", "ees", " ", "-", " ", "0.", ".3", "60", ",", " ", "where", " ", "North", " ", "=", " ", "0", " ", "(", "``", "int", "``)", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "heading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "ground", "speed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Curr", "ent", " ", "ground", "speed", " ", "in", " ", "metre", "s", "/", "second", " ", "(", "``", "double", "``)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "attribute", " ", "is", " ", "sett", "able", ".", " ", "The", " ", "set", " ", "value", " ", "is", " ", "the", " ", "default", " ", "target", " ", "ground", "speed", "\\", "10", ";", " ", " ", " ", " ", "whe", "n", " ", "movin", "g", " ", "the", " ", "vehic", "le", " ", "usi", "ng", " ", ":", "py", ":", "func", ":`", "simple", "\\u", "got", "o", "`", " ", "(", "or", " ", "other", " ", "position", "-", "based", "\\", "10", ";", " ", " ", " ", " ", "movement", " ", "command", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "ground", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ground", "speed_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "ground", "speed_", "(_", "self_", ",_", "speed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "speed", "\\u", "type_", "=_", "1_", "#", " ", "ground", " ", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "self_", "._", "message", "\\u", "factory_", "._", "command", "\\u", "long", "\\u", "encode_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "#", " ", "target", " ", "system", ",", " ", "target", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "CMD", "\\u", "DO", "\\u", "CHANGE", "\\u", "SPEED_", ",_", "#", "command_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "#", "confirmation_", "\\u\\u\\uNL\\u\\u\\u_", "speed", "\\u", "type_", ",_", "#", "param", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "speed_", ",_", "#", " ", "speed", " ", "in", " ", "metre", "s", "/", "second_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "1_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "#", "param", " ", "3", " ", "-", " ", "7_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "send", " ", "command", " ", "to", " ", "vehicle_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "send", "\\u", "mavlink", "_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "airs", "peed", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Curr", "ent", " ", "airs", "peed", " ", "in", " ", "metre", "s", "/", "second", " ", "(", "``", "double", "``)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "attribute", " ", "is", " ", "sett", "able", ".", " ", "The", " ", "set", " ", "value", " ", "is", " ", "the", " ", "default", " ", "target", " ", "airs", "peed", "\\", "10", ";", " ", " ", " ", " ", "whe", "n", " ", "movin", "g", " ", "the", " ", "vehic", "le", " ", "usi", "ng", " ", ":", "py", ":", "func", ":`", "simple", "\\u", "got", "o", "`", " ", "(", "or", " ", "other", " ", "position", "-", "based", "\\", "10", ";", " ", " ", " ", " ", "movement", " ", "command", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "airs", "peed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "airs", "peed", "_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "airs", "peed", "_", "(_", "self_", ",_", "speed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "speed", "\\u", "type_", "=_", "0_", "#", " ", "air", " ", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "self_", "._", "message", "\\u", "factory_", "._", "command", "\\u", "long", "\\u", "encode_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "#", " ", "target", " ", "system", ",", " ", "target", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "CMD", "\\u", "DO", "\\u", "CHANGE", "\\u", "SPEED_", ",_", "#", "command_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "#", "confirmation_", "\\u\\u\\uNL\\u\\u\\u_", "speed", "\\u", "type_", ",_", "#", "param", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "speed_", ",_", "#", " ", "speed", " ", "in", " ", "metre", "s", "/", "second_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "1_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "#", "param", " ", "3", " ", "-", " ", "7_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "send", " ", "command", " ", "to", " ", "vehicle_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "send", "\\u", "mavlink", "_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "gi", "mba", "l_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Gi", "mba", "l", " ", "object", " ", "for", " ", "controll", "ing", ",", " ", "viewin", "g", " ", "and", " ", "obs", "ervi", "ng", " ", "gi", "mba", "l", " ", "status", " ", "(:", "py", ":", "class", ":`", "Gi", "mba", "l", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "2.0", ".1", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "gi", "mba", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "mount", "\\u", "status_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "warn", "ing", "::", " ", "Thi", "s", " ", "method", " ", "is", " ", "depre", "cated", ".", " ", "It", " ", "has", " ", "bee", "n", " ", "replaced", " ", "by", " ", ":", "py", ":", "attr", ":`", "gi", "mba", "l", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Curr", "ent", " ", "status", " ", "of", " ", "the", " ", "came", "ra", " ", "mount", " ", "(", "gi", "mba", "l", ")", " ", "as", " ", "a", " ", "three", " ", "element", " ", "list", ":", " ", "``[", " ", "pitch", ",", " ", "yaw", ",", " ", "roll", " ", "]``", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "values", " ", "in", " ", "the", " ", "list", " ", "are", " ", "set", " ", "to", " ", "``", "Non", "e", "``", " ", "if", " ", "no", " ", "mount", " ", "is", " ", "configur", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "self_", "._", "\\u", "mount", "\\u", "pitch_", ",_", "self_", "._", "\\u", "mount", "\\u", "yaw_", ",_", "self_", "._", "\\u", "mount", "\\u", "roll_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "ek", "f", "\\u", "ok_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "``", "Tru", "e", "``", " ", "if", " ", "the", " ", "EK", "F", " ", "status", " ", "is", " ", "consider", "ed", " ", "acceptabl", "e", ",", " ", "``", "Fal", "se", "``", " ", "other", "wis", "e", " ", "(", "``", "boolean", "``)", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "lega", "cy", " ", "check", " ", "for", " ", "drone", "kit", "-", "python", " ", "for", " ", "solo", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "same", " ", "check", " ", "tha", "t", " ", "Ar", "du", "Cop", "ter", "::", "system", ".", "pde", "::", "position", "\\u", "ok", "()", " ", "is", " ", "using_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "arme", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "ek", "f", "\\u", "pos", "horiz", "abs_", "and_", "not_", "self_", "._", "\\u", "ek", "f", "\\u", "const", "pos", "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 ", " _", "return_", "self_", "._", "\\u", "ek", "f", "\\u", "pos", "horiz", "abs_", "or_", "self_", "._", "\\u", "ek", "f", "\\u", "pred", "pos", "horiz", "abs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "channels_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "RC", " ", "channel", " ", "values", " ", "from", " ", "the", " ", "RC", " ", "Transmit", "ter", " ", "(:", "py", ":", "class", ":`", "Chan", "nels", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "attribute", " ", "can", " ", "als", "o", " ", "be", " ", "used", " ", "to", " ", "set", " ", "and", " ", "read", " ", "RC", " ", "Override", " ", "(", "channel", " ", "override", ")", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "via", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "channel", "s", ".", "override", " ", "<", "drone", "kit", ".", "Chan", "nels", ".", "override", "s", ">`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "more", " ", "informati", "on", " ", "and", " ", "example", "s", " ", "see", " ", ":", "ref", ":`", "example", "\\u", "channel", "\\u", "override", "s", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "read", " ", "the", " ", "channel", "s", " ", "from", " ", "the", " ", "RC", " ", "transmitte", "r", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Get", " ", "all", " ", "channel", " ", "values", " ", "from", " ", "RC", " ", "transmitte", "r", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Chan", "nel", " ", "values", " ", "from", " ", "RC", " ", "Tx", ":\"", ",", " ", "vehic", "le", ".", "channel", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Access", " ", "channel", "s", " ", "individual", "ly", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Read", " ", "channel", "s", " ", "individual", "ly", ":\"", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", " ", "Ch", "1", ":", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "channel", "s", "['", "1", "']", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", " ", "Ch", "2", ":", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "channel", "s", "['", "2", "']", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "channels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "home", "\\u", "location_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "current", " ", "home", " ", "location", " ", "(:", "py", ":", "class", ":`", "Locat", "ion", "Global", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "get", " ", "the", " ", "attribute", " ", "you", " ", "must", " ", "first", " ", "download", " ", "the", " ", ":", "py", ":", "func", ":`", "Vehicle", ".", "command", "s", "`.", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "attribute", " ", "has", " ", "a", " ", "value", " ", "of", " ", "``", "Non", "e", "``", " ", "unti", "l", " ", ":", "py", ":", "func", ":`", "Vehicle", ".", "command", "s", "`", " ", "has", " ", "bee", "n", " ", "download", "ed", "\\", "10", ";", " ", " ", " ", " ", "**", "and", "**", " ", "the", " ", "autop", "ilo", "t", " ", "has", " ", "set", " ", "an", " ", "initial", " ", "home", " ", "location", " ", "(", "typical", "ly", " ", "where", " ", "the", " ", "vehic", "le", " ", "first", " ", "gets", " ", "GPS", " ", "lock", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "Connect", " ", "to", " ", "a", " ", "vehic", "le", " ", "object", " ", "(", "for", " ", "example", ",", " ", "on", " ", "com", "14", ")", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", " ", "=", " ", "connect", "('", "com", "14", "',", " ", "wait", "\\u", "read", "y", "=", "Tru", "e", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Down", "load", " ", "the", " ", "vehic", "le", " ", "waypoints", " ", "(", "command", "s", ").", " ", "Wait", " ", "unti", "l", " ", "download", " ", "is", " ", "complete", ".", "\\", "10", ";", " ", " ", " ", " ", "cmds", " ", "=", " ", "vehic", "le", ".", "command", "s", "\\", "10", ";", " ", " ", " ", " ", "cmds", ".", "download", "()", "\\", "10", ";", " ", " ", " ", " ", "cmds", ".", "wait", "\\u", "read", "y", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Get", " ", "the", " ", "home", " ", "location", "\\", "10", ";", " ", " ", " ", " ", "home", " ", "=", " ", "vehic", "le", ".", "home", "\\u", "location", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "``", "home", "\\u", "location", "``", " ", "is", " ", "not", " ", "observable", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "attribute", " ", "can", " ", "be", " ", "writt", "en", " ", "(", "in", " ", "the", " ", "same", " ", "way", " ", "as", " ", "any", " ", "other", " ", "attribute", ")", " ", "after", " ", "it", " ", "has", " ", "success", "full", "y", "\\", "10", ";", " ", " ", " ", " ", "bee", "n", " ", "populate", "d", " ", "from", " ", "the", " ", "vehic", "le", ".", " ", "The", " ", "value", " ", "sent", " ", "to", " ", "the", " ", "vehic", "le", " ", "is", " ", "cache", "d", " ", "in", " ", "the", " ", "attribute", "\\", "10", ";", " ", " ", " ", " ", "(", "and", " ", "can", " ", "potenti", "ally", " ", "get", " ", "out", " ", "of", " ", "date", " ", "if", " ", "you", " ", "don", "'", "t", " ", "re", "-", "download", " ", "``", "Vehicle", ".", "command", "s", "``)", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "warn", "ing", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Sett", "ing", " ", "the", " ", "value", " ", "will", " ", "fail", " ", "silently", " ", "if", " ", "the", " ", "specified", " ", "location", " ", "is", " ", "more", " ", "than", " ", "50", "km", " ", "from", " ", "the", " ", "EK", "F", " ", "orig", "in", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "copy_", "._", "copy_", "(_", "self_", "._", "\\u", "home", "\\u", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "home", "\\u", "location_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "home", "\\u", "location_", "(_", "self_", ",_", "pos_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", "s", " ", "the", " ", "home", " ", "location", " ", "(", "``", "Locat", "ion", "Global", "``)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "value", " ", "cann", "ot", " ", "be", " ", "set", " ", "unti", "l", " ", "it", " ", "has", " ", "success", "full", "y", " ", "bee", "n", " ", "read", " ", "from", " ", "the", " ", "vehic", "le", ".", " ", "Af", "ter", " ", "bei", "ng", "\\", "10", ";", " ", " ", " ", " ", "set", " ", "the", " ", "value", " ", "is", " ", "cache", "d", " ", "in", " ", "the", " ", "home", "\\u", "location", " ", "attribute", " ", "and", " ", "doe", "s", " ", "not", " ", "have", " ", "to", " ", "be", " ", "re", "-", "read", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Sett", "ing", " ", "the", " ", "value", " ", "will", " ", "fail", " ", "silently", " ", "if", " ", "the", " ", "specified", " ", "location", " ", "is", " ", "more", " ", "than", " ", "50", "km", " ", "from", " ", "the", " ", "EK", "F", " ", "orig", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "pos_", ",_", "Locat", "ion", "Global_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Except", "ing", " ", "home", "\\u", "location", " ", "to", " ", "be", " ", "set", " ", "to", " ", "a", " ", "Locat", "ion", "Global", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "cache", "d", " ", "home", " ", "location", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "home", "\\u", "location_", "=_", "copy_", "._", "copy_", "(_", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sen", "d", " ", "MAV", "Link", " ", "update", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "send", "\\u", "mavlink", "_", "(_", "self_", "._", "message", "\\u", "factory_", "._", "command", "\\u", "long", "\\u", "encode_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "#", " ", "target", " ", "system", ",", " ", "target", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "CMD", "\\u", "DO", "\\u", "SET", "\\u", "HOME_", ",_", "#", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "#", " ", "confirmation_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ",_", "#", " ", "param", " ", "1", ":", " ", "1", " ", "to", " ", "use", " ", "current", " ", "position", ",", " ", "2", " ", "to", " ", "use", " ", "the", " ", "enter", "ed", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "0_", ",_", "#", " ", "params", " ", "2", "-", "4_", "\\u\\u\\uNL\\u\\u\\u_", "pos_", "._", "lat_", ",_", "pos_", "._", "lon_", ",_", "pos_", "._", "alt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "commands_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", "s", " ", "the", " ", "edita", "ble", " ", "waypoints", "/", "current", " ", "missio", "n", " ", "for", " ", "this", " ", "vehic", "le", " ", "(:", "py", ":", "class", ":`", "Command", "Sequ", "ence", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "used", " ", "to", " ", "get", ",", " ", "create", ",", " ", "and", " ", "modif", "y", " ", "a", " ", "missio", "n", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "A", " ", ":", "py", ":", "class", ":`", "Command", "Sequ", "ence", "`", " ", "contain", "ing", " ", "the", " ", "waypoints", " ", "for", " ", "this", " ", "vehic", "le", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "commands_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "parameters_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "(", "edita", "ble", ")", " ", "parameter", "s", " ", "for", " ", "this", " ", "vehic", "le", " ", "(:", "py", ":", "class", ":`", "Parameter", "s", "`)", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "simple", "\\u", "take", "off_", "(_", "self_", ",_", "alt_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Tak", "e", " ", "off", " ", "and", " ", "fly", " ", "the", " ", "vehic", "le", " ", "to", " ", "the", " ", "specified", " ", "alti", "tude", " ", "(", "in", " ", "metre", "s", ")", " ", "and", " ", "then", " ", "wait", " ", "for", " ", "anot", "her", " ", "command", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "shou", "ld", " ", "only", " ", "be", " ", "used", " ", "on", " ", "Cop", "ter", " ", "vehic", "les", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "vehic", "le", " ", "must", " ", "be", " ", "in", " ", "GUID", "ED", " ", "mode", " ", "and", " ", "arme", "d", " ", "bef", "ore", " ", "this", " ", "is", " ", "call", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "There", " ", "is", " ", "no", " ", "mechanism", " ", "for", " ", "notification", " ", "whe", "n", " ", "the", " ", "correct", " ", "alti", "tude", " ", "is", " ", "reache", "d", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "if", " ", "anot", "her", " ", "command", " ", "arrive", "s", " ", "bef", "ore", " ", "tha", "t", " ", "point", " ", "(", "e", ".", "g", ".", " ", ":", "py", ":", "func", ":`", "simple", "\\u", "got", "o", "`)", " ", "it", " ", "will", " ", "be", " ", "run", " ", "inst", "ead", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "warn", "ing", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "App", "s", " ", "shou", "ld", " ", "code", " ", "to", " ", "ensure", " ", "tha", "t", " ", "the", " ", "vehic", "le", " ", "will", " ", "reach", " ", "a", " ", "safe", " ", "alti", "tude", " ", "bef", "ore", "\\", "10", ";", " ", " ", " ", "other", " ", "command", "s", " ", "are", " ", "executed", ".", " ", "A", " ", "good", " ", "example", " ", "is", " ", "provided", " ", "in", " ", "the", " ", "guide", " ", "topic", " ", ":", "doc", ":`", "guide", "/", "tak", "ing", "\\u", "off", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "alt", ":", " ", "Target", " ", "height", ",", " ", "in", " ", "metre", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "alt_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "altitude_", "=_", "float_", "(_", "alt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "math_", "._", "isnan_", "(_", "alt_", ")_", "or_", "math_", "._", "isinf", "_", "(_", "alt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Alt", "itu", "de", " ", "was", " ", "Na", "N", " ", "or", " ", "Infinit", "y", ".", " ", "Ple", "ase", " ", "provide", " ", "a", " ", "real", " ", "number", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "master_", "._", "mav_", "._", "command", "\\u", "long", "\\u", "send_", "(_", "0_", ",_", "0_", ",_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "CMD", "\\u", "NAV", "\\u", "TA", "KE", "OFF_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "altitude_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "simple", "\\u", "goto_", "(_", "self_", ",_", "location_", ",_", "airs", "peed", "_", "=_", "None_", ",_", "ground", "speed_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Go", " ", "to", " ", "a", " ", "specified", " ", "global", " ", "location", " ", "(:", "py", ":", "class", ":`", "Locat", "ion", "Global", "`", " ", "or", " ", ":", "py", ":", "class", ":`", "Locat", "ion", "Global", "Relative", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "There", " ", "is", " ", "no", " ", "mechanism", " ", "for", " ", "notification", " ", "whe", "n", " ", "the", " ", "target", " ", "location", " ", "is", " ", "reache", "d", ",", " ", "and", " ", "if", " ", "anot", "her", " ", "command", " ", "arrive", "s", "\\", "10", ";", " ", " ", " ", " ", "bef", "ore", " ", "tha", "t", " ", "point", " ", "tha", "t", " ", "will", " ", "be", " ", "executed", " ", "immediate", "ly", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "option", "ally", " ", "set", " ", "the", " ", "desi", "red", " ", "airs", "peed", " ", "or", " ", "ground", "speed", " ", "(", "this", " ", "is", " ", "identi", "cal", " ", "to", " ", "setti", "ng", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "attr", ":`", "airs", "peed", "`", " ", "or", " ", ":", "py", ":", "attr", ":`", "ground", "speed", "`)", ".", " ", "The", " ", "vehic", "le", " ", "will", " ", "dete", "rmin", "e", " ", "what", " ", "speed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "use", " ", "if", " ", "the", " ", "values", " ", "are", " ", "not", " ", "set", " ", "or", " ", "if", " ", "the", "y", " ", "are", " ", "bot", "h", " ", "set", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "method", " ", "will", " ", "change", " ", "the", " ", ":", "py", ":", "class", ":`", "Vehicle", "Mode", "`", " ", "to", " ", "``", "GUID", "ED", "``", " ", "if", " ", "necessar", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Set", " ", "mode", " ", "to", " ", "guide", "d", " ", "-", " ", "this", " ", "is", " ", "option", "al", " ", "as", " ", "the", " ", "simple", "\\u", "got", "o", " ", "method", " ", "will", " ", "change", " ", "the", " ", "mode", " ", "if", " ", "need", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "mode", " ", "=", " ", "Vehicle", "Mode", "(\"", "GUID", "ED", "\")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Set", " ", "the", " ", "Locat", "ion", "Global", " ", "to", " ", "head", " ", "towards", "\\", "10", ";", " ", " ", " ", " ", "a", "\\u", "location", " ", "=", " ", "Locat", "ion", "Global", "(-", "34.", "364", "114", ",", " ", "149", ".1", "660", "2", "2", ",", " ", "30", ")", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "simple", "\\u", "got", "o", "(", "a", "\\u", "location", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "location", ":", " ", "The", " ", "target", " ", "location", " ", "(:", "py", ":", "class", ":`", "Locat", "ion", "Global", "`", " ", "or", " ", ":", "py", ":", "class", ":`", "Locat", "ion", "Global", "Relative", "`)", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "airs", "peed", ":", " ", "Target", " ", "airs", "peed", " ", "in", " ", "m", "/", "s", " ", "(", "option", "al", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ground", "speed", ":", " ", "Target", " ", "ground", "speed", " ", "in", " ", "m", "/", "s", " ", "(", "option", "al", ").", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "location_", ",_", "Locat", "ion", "Global", "Relative", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "FRAME", "\\u", "GLOB", "AL", "\\u", "RELAT", "IV", "E", "\\u", "ALT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alt_", "=_", "location_", "._", "alt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "location_", ",_", "Locat", "ion", "Global_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "be", " ", "the", " ", "proper", " ", "code", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "frame", " ", "=", " ", "mav", "util", ".", "mavlink", ".", "MAV", "\\u", "FRAME", "\\u", "GLOBAL_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "we", "ver", ",", " ", "AP", "M", " ", "discard", "s", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "relative", " ", "frame_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "treat", "s", " ", "any", " ", "alt", " ", "value", " ", "as", " ", "relative", ".", " ", "So", " ", "we", " ", "compen", "sat", "e", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "FRAME", "\\u", "GLOB", "AL", "\\u", "RELAT", "IV", "E", "\\u", "ALT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "home", "\\u", "location_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "commands_", "._", "download_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "commands_", "._", "wait", "\\u", "ready_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "alt_", "=_", "location_", "._", "alt_", "-_", "self_", "._", "home", "\\u", "location_", "._", "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 ", " _", "raise_", "API", "Exception_", "(_", "'", "Expecti", "ng", " ", "location", " ", "to", " ", "be", " ", "Locat", "ion", "Global", " ", "or", " ", "Locat", "ion", "Global", "Relative", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "master_", "._", "mav_", "._", "missio", "n", "\\u", "item", "\\u", "send_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "frame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "CMD", "\\u", "NAV", "\\u", "WAY", "POINT_", ",_", "2_", ",_", "0_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "0_", ",_", "location_", "._", "lat_", ",_", "location_", "._", "lon_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "airs", "peed", "_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "airs", "peed", "_", "=_", "airs", "peed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ground", "speed_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ground", "speed_", "=_", "ground", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "mavlink", "_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "used", " ", "to", " ", "send", " ", "raw", " ", "MAV", "Link", " ", "\"", "custom", " ", "message", "s", "\"", " ", "to", " ", "the", " ", "vehic", "le", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "function", " ", "can", " ", "send", " ", "arbitra", "ry", " ", "message", "s", "/", "command", "s", " ", "to", " ", "the", " ", "connect", "ed", " ", "vehic", "le", " ", "at", " ", "any", " ", "time", " ", "and", " ", "in", " ", "any", " ", "vehic", "le", " ", "mode", ".", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "is", " ", "partic", "ular", "ly", " ", "usef", "ul", " ", "for", " ", "controll", "ing", " ", "vehic", "les", " ", "outsi", "de", " ", "of", " ", "missio", "ns", " ", "(", "for", " ", "example", ",", " ", "in", " ", "GUID", "ED", " ", "mode", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", ":", "py", ":", "func", ":`", "message", "\\u", "factor", "y", " ", "<", "drone", "kit", ".", "Vehicle", ".", "message", "\\u", "factor", "y", ">`", " ", "is", " ", "used", " ", "to", " ", "create", " ", "message", "s", " ", "in", " ", "the", " ", "appropr", "iate", " ", "format", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "more", " ", "informati", "on", " ", "see", " ", "the", " ", "guide", " ", "topic", ":", " ", ":", "ref", ":`", "guide", "d\\u", "mode", "\\u", "how", "\\u", "to", "\\u", "send", "\\u", "command", "s", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "message", ":", " ", "A", " ", "``", "MAV", "Link", "\\u", "message", "``", " ", "instance", ",", " ", "created", " ", "usi", "ng", " ", ":", "py", ":", "func", ":`", "message", "\\u", "factor", "y", " ", "<", "drone", "kit", ".", "Vehicle", ".", "message", "\\u", "factor", "y", ">`", ".", "\\", "10", ";", " ", " ", " ", " ", "There", " ", "is", " ", "need", " ", "to", " ", "speci", "fy", " ", "the", " ", "system", " ", "id", ",", " ", "component", " ", "id", " ", "or", " ", "sequence", " ", "number", " ", "of", " ", "message", "s", " ", "as", " ", "the", " ", "API", " ", "will", " ", "set", " ", "these", " ", "appropr", "iate", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "master_", "._", "mav_", "._", "send_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "message", "\\u", "factory_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "an", " ", "object", " ", "tha", "t", " ", "can", " ", "be", " ", "used", " ", "to", " ", "create", " ", "'", "raw", "'", " ", "MAV", "Link", " ", "message", "s", " ", "tha", "t", " ", "are", " ", "appropr", "iate", " ", "for", " ", "this", " ", "vehic", "le", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "message", " ", "can", " ", "then", " ", "be", " ", "sent", " ", "usi", "ng", " ", ":", "py", ":", "func", ":`", "send", "\\u", "mavlink", "(", "message", ")", " ", "<", "drone", "kit", ".", "Vehicle", ".", "send", "\\u", "mavlink", ">`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Vehicle", "s", " ", "support", " ", "a", " ", "subse", "t", " ", "of", " ", "the", " ", "message", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "MAV", "Link", " ", "standard", ".", " ", "For", " ", "more", " ", "informati", "on", "\\", "10", ";", " ", " ", " ", " ", "abo", "ut", " ", "the", " ", "support", "ed", " ", "sets", " ", "see", " ", "wiki", " ", "topic", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "`", "Cop", "ter", " ", "Command", "s", " ", "in", " ", "Guide", "d", " ", "Mode", " ", "<", "http", "://", "dev", ".", "ard", "upi", "lot", ".", "com", "/", "wiki", "/", "cop", "ter", "-", "command", "s", "-", "in", "-", "guide", "d", "-", "mode", "/>", "`\\u", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "`", "Plan", "e", " ", "Command", "s", " ", "in", " ", "Guide", "d", " ", "Mode", " ", "<", "http", "://", "dev", ".", "ard", "upi", "lot", ".", "com", "/", "wiki", "/", "plane", "-", "command", "s", "-", "in", "-", "guide", "d", "-", "mode", "/>", "`\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "message", " ", "types", " ", "are", " ", "defin", "ed", " ", "in", " ", "the", " ", "central", " ", "MAV", "Link", " ", "git", "hub", " ", "repos", "itor", "y", ".", " ", " ", "For", " ", "example", ",", " ", "a", " ", "Pix", "haw", "k", " ", "underst", "ands", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "follow", "ing", " ", "message", "s", " ", "(", "from", " ", "`", "pix", "haw", "k", ".", "xml", " ", "<", "https", "://", "git", "hub", ".", "com", "/", "mavlink", "/", "mavlink", "/", "blob", "/", "master", "/", "message", "\\u", "definit", "ion", "s", "/", "v1", ".0", "/", "pix", "haw", "k", ".", "xml", ">`\\u", "):", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "xml", "\\", "10", ";", "\\", "10", ";", " ", " ", "<", "message", " ", "id", "=\"", "153", "\"", " ", "name", "=\"", "IMA", "GE", "\\u", "TRIGGER", "\\u", "CONTR", "OL", "\">", "\\", "10", ";", " ", " ", " ", "<", "field", " ", "type", "=\"", "uint", "8", "\\u", "t", "\"", " ", "name", "=\"", "enable", "\">", "0", " ", "to", " ", "disable", ",", " ", "1", " ", "to", " ", "enable", "</", "field", ">", "\\", "10", ";", " ", " ", "</", "message", ">", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "name", " ", "of", " ", "the", " ", "factor", "y", " ", "method", " ", "will", " ", "alw", "ay", "s", " ", "be", " ", "the", " ", "lower", " ", "case", " ", "version", " ", "of", " ", "the", " ", "message", " ", "name", " ", "with", " ", "*\\u", "encode", "*", " ", "append", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "Ea", "ch", " ", "field", " ", "in", " ", "the", " ", "XML", " ", "message", " ", "definit", "ion", " ", "must", " ", "be", " ", "liste", "d", " ", "as", " ", "argu", "ment", "s", " ", "to", " ", "this", " ", "factor", "y", " ", "method", ".", " ", " ", "So", " ", "for", " ", "this", " ", "example", "\\", "10", ";", " ", " ", " ", " ", "message", ",", " ", "the", " ", "call", " ", "wou", "ld", " ", "be", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "msg", " ", "=", " ", "vehic", "le", ".", "message", "\\u", "factor", "y", ".", "image", "\\u", "trigger", "\\u", "control", "\\u", "encode", "(", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "send", "\\u", "mavlink", "(", "msg", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Some", " ", "message", " ", "types", " ", "include", " ", "\"", "address", "ing", " ", "informati", "on", "\".", " ", "If", " ", "presen", "t", ",", " ", "there", " ", "is", " ", "no", " ", "need", " ", "to", " ", "speci", "fy", " ", "the", " ", "``", "target", "\\u", "system", "``", "\\", "10", ";", " ", " ", " ", " ", "id", " ", "(", "just", " ", "set", " ", "to", " ", "zero", ")", " ", "as", " ", "Dro", "ne", "Kit", " ", "will", " ", "automati", "call", "y", " ", "update", " ", "message", "s", " ", "with", " ", "the", " ", "correct", " ", "ID", " ", "for", " ", "the", " ", "connect", "ed", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", " ", "bef", "ore", " ", "sendin", "g", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "``", "target", "\\u", "component", "``", " ", "shou", "ld", " ", "be", " ", "set", " ", "to", " ", "0", " ", "(", "broadcast", ")", " ", "unl", "ess", " ", "the", " ", "message", " ", "is", " ", "to", " ", "specific", " ", "component", ".", "\\", "10", ";", " ", " ", " ", " ", "CR", "C", " ", "fields", " ", "and", " ", "sequence", " ", "numbers", " ", "(", "if", " ", "defin", "ed", " ", "in", " ", "the", " ", "message", " ", "type", ")", " ", "are", " ", "automati", "call", "y", " ", "set", " ", "by", " ", "Dro", "ne", "Kit", " ", "and", " ", "can", " ", "als", "o", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "ignore", "d", "/", "set", " ", "to", " ", "zero", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "more", " ", "informati", "on", " ", "see", " ", "the", " ", "guide", " ", "topic", ":", " ", ":", "ref", ":`", "guide", "d\\u", "mode", "\\u", "how", "\\u", "to", "\\u", "send", "\\u", "command", "s", "`.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "master_", "._", "mav_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "initialize_", "(_", "self_", ",_", "rate_", "=_", "4_", ",_", "heart", "beat", "\\u", "timeout_", "=_", "30_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "handler_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "heart", "beat", " ", "polling", "._", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "error_", "=_", "heart", "beat", "\\u", "timeout_", "or_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "started_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "lastr", "ece", "ive", "d_", "=_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Poll", " ", "for", " ", "first", " ", "heart", "beat", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "heart", "beat", " ", "times", " ", "out", ",", " ", "this", " ", "will", " ", "interrupt", "._", "\\u\\u\\uNL\\u\\u\\u_", "while_", "self_", "._", "\\u", "handler_", "._", "\\u", "alive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", ".1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "heart", "beat", "\\u", "lastr", "ece", "ive", "d_", "!=_", "start_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "handler_", "._", "\\u", "alive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "API", "Exception_", "(_", "'", "Time", "out", " ", "in", " ", "initiali", "zin", "g", " ", "connecti", "on", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Register", " ", "target", "\\u", "system", " ", "now", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "handler_", "._", "target", "\\u", "system_", "=_", "self_", "._", "\\u", "heart", "beat", "\\u", "system_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wait", " ", "unti", "l", " ", "board", " ", "has", " ", "boot", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "flight", "mode_", "not_", "in_", "[_", "None_", ",_", "'", "INITIAL", "ISI", "NG", "'_", ",_", "'", "MAV", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "data", " ", "stream", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rate_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "master_", "._", "mav_", "._", "request", "\\u", "data\\u", "stream", "\\u", "send_", "(_", "0_", ",_", "0_", ",_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "DATA", "\\u", "STRE", "AM", "\\u", "ALL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rate_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "add", "\\u", "message", "\\u", "listener_", "(_", "'", "HEA", "RT", "BEA", "T", "'_", ",_", "self_", "._", "send", "\\u", "capab", "ilt", "ies", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "initial", " ", "parameter", " ", "download", " ", "has", " ", "start", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "fn", " ", "actual", "ly", " ", "rate", " ", "limit", "s", " ", "its", "elf", " ", "to", " ", "every", " ", "2s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ju", "st", " ", "retr", "y", " ", "with", " ", "persiste", "nce", " ", "to", " ", "get", " ", "our", " ", "first", " ", "param", " ", "stream", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "master_", "._", "param", "\\u", "fetch", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "params", "\\u", "count_", ">_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\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_", "send", "\\u", "capab", "ilt", "ies", "\\u", "request_", "(_", "self_", ",_", "vehicle_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Request", " ", "an", " ", "AUTO", "PI", "LOT", "\\u", "VERSI", "ON", " ", "packet", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "capab", "ilit", "y", "\\u", "msg_", "=_", "vehicle_", "._", "message", "\\u", "factory_", "._", "command", "\\u", "long", "\\u", "encode_", "(_", "0_", ",_", "0_", ",_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "CMD", "\\u", "REQUEST", "\\u", "AUTO", "PI", "LOT", "\\u", "CAPA", "BIL", "ITI", "ES_", ",_", "0_", ",_", "1_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vehicle_", "._", "send", "\\u", "mavlink", "_", "(_", "capab", "ilit", "y", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wait", "\\u", "ready_", "(_", "self_", ",_", "*_", "types_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Wait", "s", " ", "for", " ", "specified", " ", "attribute", "s", " ", "to", " ", "be", " ", "populate", "d", " ", "from", " ", "the", " ", "vehic", "le", " ", "(", "values", " ", "are", " ", "initially", " ", "``", "Non", "e", "``)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "typical", "ly", " ", "call", "ed", " ", "\"", "beh", "ind", " ", "the", " ", "scenes", "\"", " ", "to", " ", "ensure", " ", "tha", "t", " ", ":", "py", ":", "func", ":`", "connect", "`", " ", "doe", "s", " ", "not", " ", "return", " ", "unti", "l", "\\", "10", ";", " ", " ", " ", " ", "attribute", "s", " ", "have", " ", "populate", "d", " ", "(", "via", " ", "the", " ", "``", "wait", "\\u", "read", "y", "``", " ", "parameter", ").", " ", "You", " ", "can", " ", "als", "o", " ", "use", " ", "it", " ", "after", " ", "connecti", "ng", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "wait", " ", "on", " ", "a", " ", "specific", " ", "value", "(", "s", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "There", " ", "are", " ", "two", " ", "way", "s", " ", "to", " ", "call", " ", "the", " ", "method", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "Wait", " ", "on", " ", "default", " ", "attribute", "s", " ", "to", " ", "populate", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "wait", "\\u", "read", "y", "(", "Tru", "e", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "Wait", " ", "on", " ", "specified", " ", "attribute", "s", " ", "(", "or", " ", "array", " ", "of", " ", "attribute", "s", ")", " ", "to", " ", "populate", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "wait", "\\u", "read", "y", "('", "mode", "','", "airs", "peed", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "ing", " ", "the", " ", "``", "wait", "\\u", "read", "y", "(", "Tru", "e", ")`", "`", " ", "waits", " ", "on", " ", ":", "py", ":", "attr", ":`", "parameter", "s", "`", ",", " ", ":", "py", ":", "attr", ":`", "gps", "\\u", "0", "`", ",", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "attr", ":`", "arme", "d", "`", ",", " ", ":", "py", ":", "attr", ":`", "mode", "`", ",", " ", "and", " ", ":", "py", ":", "attr", ":`", "atti", "tude", "`.", " ", "In", " ", "practic", "e", " ", "this", " ", "usual", "ly", "\\", "10", ";", " ", " ", " ", " ", "means", " ", "tha", "t", " ", "all", " ", "support", "ed", " ", "attribute", "s", " ", "will", " ", "be", " ", "populate", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "default", ",", " ", "the", " ", "method", " ", "will", " ", "timeo", "ut", " ", "after", " ", "30", " ", "second", "s", " ", "and", " ", "raise", " ", "an", " ", "exception", " ", "if", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "attribute", "s", " ", "wer", "e", " ", "not", " ", "populate", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "types", ":", " ", "``", "Tru", "e", "``", " ", "to", " ", "wait", " ", "on", " ", "the", " ", "default", " ", "set", " ", "of", " ", "attribute", "s", ",", " ", "or", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "comma", "-", "separate", "d", " ", "list", " ", "of", " ", "the", " ", "specific", " ", "attribute", "s", " ", "to", " ", "wait", " ", "on", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "int", " ", "timeo", "ut", ":", " ", "Time", "out", " ", "in", " ", "second", "s", " ", "after", " ", "whi", "ch", " ", "the", " ", "method", " ", "will", " ", "raise", " ", "an", " ", "exception", "\\", "10", ";", " ", " ", " ", " ", "(", "the", " ", "default", ")", " ", "or", " ", "return", " ", "``", "Fal", "se", "``.", " ", "The", " ", "default", " ", "timeo", "ut", " ", "is", " ", "30", " ", "second", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "Boo", "lean", " ", "raise", "\\u", "exception", ":", " ", "If", " ", "``", "Tru", "e", "``", " ", "the", " ", "method", " ", "will", " ", "raise", " ", "an", " ", "exception", " ", "on", " ", "timeo", "ut", ",", "\\", "10", ";", " ", " ", " ", " ", "other", "wis", "e", " ", "the", " ", "method", " ", "will", " ", "return", " ", "``", "Fal", "se", "``.", " ", "The", " ", "default", " ", "is", " ", "``", "Tru", "e", "``", " ", "(", "raise", " ", "exception", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timeout_", "=_", "kwargs_", "._", "get_", "(_", "'", "timeo", "ut", "'_", ",_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise", "\\u", "exception_", "=_", "kwargs_", "._", "get_", "(_", "'", "raise", "\\u", "exception", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Vehicle", " ", "default", "s", " ", "for", " ", "wait", "\\u", "read", "y", "(", "Tru", "e", ")", " ", "or", " ", "wait", "\\u", "read", "y", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "list_", "(_", "types_", ")_", "==_", "[_", "True_", "]_", "or_", "list_", "(_", "types_", ")_", "==_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "types_", "=_", "self_", "._", "\\u", "default", "\\u", "read", "y", "\\u", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "all_", "(_", "isinstance_", "(_", "item_", ",_", "basestring_", ")_", "for_", "item_", "in_", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "API", "Exception_", "(_", "'", "wait", "\\u", "read", "y", " ", "expect", "s", " ", "one", " ", "or", " ", "more", " ", "string", " ", "argu", "ment", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wait", " ", "for", " ", "these", " ", "attribute", "s", " ", "to", " ", "have", " ", "bee", "n", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "await_", "=_", "set_", "(_", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "await_", "._", "issubset_", "(_", "self_", "._", "\\u", "read", "y", "\\u", "attrs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "-_", "start_", ">_", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "raise", "\\u", "exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "API", "Exception_", "(_", "'", "wait", "\\u", "read", "y", " ", "experience", "d", " ", "a", " ", "timeo", "ut", " ", "after", " ", "%", "s", " ", "second", "s", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "timeout_", ")_", "\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Gi", "mba", "l_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Gi", "mba", "l", " ", "status", " ", "and", " ", "control", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "object", " ", "of", " ", "this", " ", "type", " ", "is", " ", "return", "ed", " ", "by", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "gi", "mba", "l", "`.", " ", "The", "\\", "10", ";", " ", " ", " ", " ", "gi", "mba", "l", " ", "orientation", " ", "can", " ", "be", " ", "obtain", "ed", " ", "from", " ", "its", " ", ":", "py", ":", "attr", ":`", "roll", "`", ",", " ", ":", "py", ":", "attr", ":`", "pitch", "`", " ", "and", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "attr", ":`", "yaw", "`", " ", "attribute", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "gi", "mba", "l", " ", "orientation", " ", "can", " ", "be", " ", "set", " ", "explicit", "ly", " ", "usi", "ng", " ", ":", "py", ":", "func", ":`", "rota", "te", "`", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "you", " ", "can", " ", "set", " ", "the", " ", "gi", "mba", "l", " ", "(", "and", " ", "vehic", "le", ")", " ", "to", " ", "track", " ", "a", " ", "specific", " ", "\"", "region", " ", "of", " ", "interest", "\"", " ", "usi", "ng", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "func", ":`", "target", "\\u", "location", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "The", " ", "orientation", " ", "attribute", "s", " ", "are", " ", "created", " ", "with", " ", "values", " ", "of", " ", "``", "Non", "e", "``.", " ", "If", " ", "a", " ", "gi", "mba", "l", " ", "is", " ", "presen", "t", ",", "\\", "10", ";", " ", " ", "the", " ", "attribute", "s", " ", "are", " ", "populate", "d", " ", "short", "ly", " ", "after", " ", "initiali", "sation", " ", "by", " ", "message", "s", " ", "from", " ", "the", " ", "autop", "ilo", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "The", " ", "attribute", " ", "values", " ", "reflect", " ", "the", " ", "last", " ", "gi", "mba", "l", " ", "setti", "ng", "-", "values", " ", "rat", "her", " ", "than", " ", "actual", " ", "measure", "d", " ", "values", ".", "\\", "10", ";", " ", " ", "Thi", "s", " ", "means", " ", "tha", "t", " ", "the", " ", "values", " ", "won", "'", "t", " ", "change", " ", "if", " ", "you", " ", "manu", "ally", " ", "move", " ", "the", " ", "gi", "mba", "l", ",", " ", "and", " ", "tha", "t", " ", "the", " ", "value", "\\", "10", ";", " ", " ", "will", " ", "change", " ", "whe", "n", " ", "you", " ", "set", " ", "it", ",", " ", "even", " ", "if", " ", "the", " ", "specified", " ", "orientation", " ", "is", " ", "not", " ", "support", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "A", " ", "gi", "mba", "l", " ", "may", " ", "not", " ", "support", " ", "all", " ", "axes", " ", "of", " ", "rotati", "on", ".", " ", "For", " ", "example", ",", " ", "the", " ", "Sol", "o", " ", "gi", "mba", "l", " ", "will", " ", "set", " ", "pitch", "\\", "10", ";", " ", " ", "values", " ", "from", " ", "0", " ", "to", " ", "-", "90", " ", "(", "straight", " ", "ahe", "ad", " ", "to", " ", "straight", " ", "down", "),", " ", "it", " ", "will", " ", "rota", "te", " ", "the", " ", "vehic", "le", " ", "to", " ", "follow", " ", "specified", "\\", "10", ";", " ", " ", "yaw", " ", "values", ",", " ", "and", " ", "will", " ", "ignore", " ", "roll", " ", "command", "s", " ", "(", "not", " ", "support", "ed", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Gi", "mba", "l_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "vehicle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Gi", "mba", "l_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "pitch_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "roll_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "yaw_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "=_", "vehicle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "vehicle_", "._", "on", "\\u", "message_", "(_", "'", "MOUNT", "\\u", "STATUS", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "vehicle_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "pitch_", "=_", "m_", "._", "pointi", "ng", "\\u", "a_", "/_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "roll_", "=_", "m_", "._", "pointi", "ng", "\\u", "b_", "/_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "yaw_", "=_", "m_", "._", "pointi", "ng", "\\u", "c_", "/_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vehicle_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "gi", "mba", "l", "'_", ",_", "vehicle_", "._", "gi", "mba", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gi", "mba", "l_", "(_", "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_", "def_", "pitch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Gi", "mba", "l", " ", "pitch", " ", "in", " ", "degr", "ees", " ", "relative", " ", "to", " ", "the", " ", "vehic", "le", " ", "(", "see", " ", "diag", "ram", " ", "for", " ", ":", "ref", ":`", "atti", "tude", " ", "<", "figure", "\\u", "atti", "tude", ">`", ").", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "value", " ", "of", " ", "0", " ", "represent", "s", " ", "a", " ", "came", "ra", " ", "point", "ed", " ", "straight", " ", "ahe", "ad", " ", "relative", " ", "to", " ", "the", " ", "front", " ", "of", " ", "the", " ", "vehic", "le", ",", "\\", "10", ";", " ", " ", " ", " ", "whi", "le", " ", "-", "90", " ", "points", " ", "the", " ", "came", "ra", " ", "straight", " ", "down", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "last", " ", "pitch", " ", "value", " ", "sent", " ", "to", " ", "the", " ", "gi", "mba", "l", " ", "(", "not", " ", "the", " ", "actual", "/", "measure", "d", " ", "pitch", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "pitch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gi", "mba", "l_", "(_", "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_", "def_", "roll_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Gi", "mba", "l", " ", "roll", " ", "in", " ", "degr", "ees", " ", "relative", " ", "to", " ", "the", " ", "vehic", "le", " ", "(", "see", " ", "diag", "ram", " ", "for", " ", ":", "ref", ":`", "atti", "tude", " ", "<", "figure", "\\u", "atti", "tude", ">`", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "last", " ", "roll", " ", "value", " ", "sent", " ", "to", " ", "the", " ", "gi", "mba", "l", " ", "(", "not", " ", "the", " ", "actual", "/", "measure", "d", " ", "roll", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "roll_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gi", "mba", "l_", "(_", "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_", "def_", "yaw_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Gi", "mba", "l", " ", "yaw", " ", "in", " ", "degr", "ees", " ", "relative", " ", "to", " ", "*", "global", " ", "frame", "*", " ", "(", "0", " ", "is", " ", "North", ",", " ", "90", " ", "is", " ", "West", ",", " ", "180", " ", "is", " ", "South", " ", "etc", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "last", " ", "yaw", " ", "value", " ", "sent", " ", "to", " ", "the", " ", "gi", "mba", "l", " ", "(", "not", " ", "the", " ", "actual", "/", "measure", "d", " ", "yaw", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "yaw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gi", "mba", "l_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rotate_", "(_", "self_", ",_", "pitch_", ",_", "roll_", ",_", "yaw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rotate", " ", "the", " ", "gi", "mba", "l", " ", "to", " ", "a", " ", "specific", " ", "vector", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "Point", " ", "the", " ", "gi", "mba", "l", " ", "straight", " ", "down", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "gi", "mba", "l", ".", "rota", "te", "(-", "90", ",", " ", "0", ",", " ", "0", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "pitch", ":", " ", "Gi", "mba", "l", " ", "pitch", " ", "in", " ", "degr", "ees", " ", "relative", " ", "to", " ", "the", " ", "vehic", "le", " ", "(", "see", " ", "diag", "ram", " ", "for", " ", ":", "ref", ":`", "atti", "tude", " ", "<", "figure", "\\u", "atti", "tude", ">`", ").", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "value", " ", "of", " ", "0", " ", "represent", "s", " ", "a", " ", "came", "ra", " ", "point", "ed", " ", "straight", " ", "ahe", "ad", " ", "relative", " ", "to", " ", "the", " ", "front", " ", "of", " ", "the", " ", "vehic", "le", ",", "\\", "10", ";", " ", " ", " ", " ", "whi", "le", " ", "-", "90", " ", "points", " ", "the", " ", "came", "ra", " ", "straight", " ", "down", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "roll", ":", " ", "Gi", "mba", "l", " ", "roll", " ", "in", " ", "degr", "ees", " ", "relative", " ", "to", " ", "the", " ", "vehic", "le", " ", "(", "see", " ", "diag", "ram", " ", "for", " ", ":", "ref", ":`", "atti", "tude", " ", "<", "figure", "\\u", "atti", "tude", ">`", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "yaw", ":", " ", "Gi", "mba", "l", " ", "yaw", " ", "in", " ", "degr", "ees", " ", "relative", " ", "to", " ", "*", "global", " ", "frame", "*", " ", "(", "0", " ", "is", " ", "North", ",", " ", "90", " ", "is", " ", "West", ",", " ", "180", " ", "is", " ", "South", " ", "etc", ".)", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "self_", "._", "\\u", "vehicle_", "._", "message", "\\u", "factory_", "._", "mount", "\\u", "configur", "e\\u", "encode_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "1_", ",_", "#", " ", "target", " ", "system", ",", " ", "target", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "MOUNT", "\\u", "MODE", "\\u", "MAV", "LINK", "\\u", "TARGET", "ING_", ",_", "#", "mount", "\\u", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ",_", "#", " ", "stab", "iliz", "e", " ", "roll_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ",_", "#", " ", "stab", "iliz", "e", " ", "pitch_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ",_", "#", " ", "stab", "iliz", "e", " ", "yaw_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "send", "\\u", "mavlink", "_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "self_", "._", "\\u", "vehicle_", "._", "message", "\\u", "factory_", "._", "mount", "\\u", "control", "\\u", "encode_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "1_", ",_", "#", " ", "target", " ", "system", ",", " ", "target", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "pitch_", "*_", "100_", ",_", "#", " ", "pitch", " ", "is", " ", "in", " ", "cent", "ide", "gree", "s_", "\\u\\u\\uNL\\u\\u\\u_", "roll_", "*_", "100_", ",_", "#", " ", "roll_", "\\u\\u\\uNL\\u\\u\\u_", "yaw_", "*_", "100_", ",_", "#", " ", "yaw", " ", "is", " ", "in", " ", "cent", "ide", "gree", "s_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ")_", "#", " ", "save", " ", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "send", "\\u", "mavlink", "_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gi", "mba", "l_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "target", "\\u", "location_", "(_", "self_", ",_", "roi_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Point", " ", "the", " ", "gi", "mba", "l", " ", "at", " ", "a", " ", "specific", " ", "region", " ", "of", " ", "interest", " ", "(", "ROI", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "Set", " ", "the", " ", "came", "ra", " ", "to", " ", "track", " ", "the", " ", "current", " ", "home", " ", "location", ".", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "gi", "mba", "l", ".", "target", "\\u", "location", "(", "vehic", "le", ".", "home", "\\u", "location", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "target", " ", "position", " ", "must", " ", "be", " ", "defin", "ed", " ", "in", " ", "a", " ", ":", "py", ":", "class", ":`", "Locat", "ion", "Global", "Relative", "`", " ", "or", " ", ":", "py", ":", "class", ":`", "Locat", "ion", "Global", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "can", " ", "be", " ", "call", "ed", " ", "in", " ", "AUTO", " ", "or", " ", "GUID", "ED", " ", "mode", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "order", " ", "to", " ", "clear", " ", "an", " ", "ROI", " ", "you", " ", "can", " ", "send", " ", "a", " ", "location", " ", "with", " ", "all", " ", "zero", "s", " ", "(", "e", ".", "g", ".", " ", "``", "Locat", "ion", "Global", "Relative", "(", "0", ",", "0", ",", "0", ")`", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "roi", ":", " ", "Target", " ", "location", " ", "in", " ", "global", " ", "relative", " ", "frame", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "set", " ", "gi", "mba", "l", " ", "to", " ", "targeti", "ng", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "self_", "._", "\\u", "vehicle_", "._", "message", "\\u", "factory_", "._", "mount", "\\u", "configur", "e\\u", "encode_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "1_", ",_", "#", " ", "target", " ", "system", ",", " ", "target", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "MOUNT", "\\u", "MODE", "\\u", "GPS", "\\u", "POINT_", ",_", "#", "mount", "\\u", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ",_", "#", " ", "stab", "iliz", "e", " ", "roll_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ",_", "#", " ", "stab", "iliz", "e", " ", "pitch_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ",_", "#", " ", "stab", "iliz", "e", " ", "yaw_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "send", "\\u", "mavlink", "_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Get", " ", "alti", "tude", " ", "relative", " ", "to", " ", "home", " ", "irre", "spect", "ive", " ", "of", " ", "Locat", "ion", " ", "object", " ", "pass", "ed", " ", "in", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "roi_", ",_", "Locat", "ion", "Global", "Relative", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alt_", "=_", "roi_", "._", "alt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "roi_", ",_", "Locat", "ion", "Global_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "home", "\\u", "location_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "commands_", "._", "download_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "commands_", "._", "wait", "\\u", "ready_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "alt_", "=_", "roi_", "._", "alt_", "-_", "self_", "._", "home", "\\u", "location_", "._", "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 ", " _", "raise_", "API", "Exception_", "(_", "'", "Expecti", "ng", " ", "location", " ", "to", " ", "be", " ", "Locat", "ion", "Global", " ", "or", " ", "Locat", "ion", "Global", "Relative", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "the", " ", "ROI", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "self_", "._", "\\u", "vehicle_", "._", "message", "\\u", "factory_", "._", "command", "\\u", "long", "\\u", "encode_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "1_", ",_", "#", " ", "target", " ", "system", ",", " ", "target", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "CMD", "\\u", "DO", "\\u", "SET", "\\u", "ROI", "_", ",_", "#", "command_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "#", "confirmation_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "#", "params", " ", "1", "-", "4_", "\\u\\u\\uNL\\u\\u\\u_", "roi_", "._", "lat_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "roi_", "._", "lon_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alt_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "send", "\\u", "mavlink", "_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gi", "mba", "l_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "release_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Release", " ", "control", " ", "of", " ", "the", " ", "gi", "mba", "l", " ", "to", " ", "the", " ", "user", " ", "(", "RC", " ", "Control", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "shou", "ld", " ", "be", " ", "call", "ed", " ", "onc", "e", " ", "you", "'", "ve", " ", "finish", "ed", " ", "controll", "ing", " ", "the", " ", "mount", " ", "with", " ", "eit", "her", " ", ":", "py", ":", "func", ":`", "rota", "te", "`", "\\", "10", ";", " ", " ", " ", " ", "or", " ", ":", "py", ":", "func", ":`", "target", "\\u", "location", "`.", " ", "Control", " ", "will", " ", "automati", "call", "y", " ", "be", " ", "released", " ", "if", " ", "you", " ", "change", " ", "vehic", "le", " ", "mode", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "self_", "._", "\\u", "vehicle_", "._", "message", "\\u", "factory_", "._", "mount", "\\u", "configur", "e\\u", "encode_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "1_", ",_", "#", " ", "target", " ", "system", ",", " ", "target", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "MOUNT", "\\u", "MODE", "\\u", "RC", "\\u", "TARGET", "ING_", ",_", "#", "mount", "\\u", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ",_", "#", " ", "stab", "iliz", "e", " ", "roll_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ",_", "#", " ", "stab", "iliz", "e", " ", "pitch_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ",_", "#", " ", "stab", "iliz", "e", " ", "yaw_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "send", "\\u", "mavlink", "_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gi", "mba", "l_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Gi", "mba", "l", ":", " ", "pitch", "={", "0", "},", " ", "roll", "={", "1", "},", " ", "yaw", "={", "2", "}\"_", "._", "format_", "(_", "self_", "._", "pitch_", ",_", "self_", "._", "roll_", ",_", "self_", "._", "yaw_", ")_", "\\u\\u\\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_", "Parameters_", "(_", "collections_", "._", "Mut", "able", "Mapping_", ",_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "object", " ", "is", " ", "used", " ", "to", " ", "get", " ", "and", " ", "set", " ", "the", " ", "values", " ", "of", " ", "named", " ", "parameter", "s", " ", "for", " ", "a", " ", "vehic", "le", ".", " ", "See", " ", "the", " ", "follow", "ing", " ", "link", "s", " ", "for", " ", "informati", "on", " ", "abo", "ut", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "support", "ed", " ", "parameter", "s", " ", "for", " ", "each", " ", "platform", ":", " ", "`", "Cop", "ter", " ", "Parameter", "s", " ", "<", "http", "://", "cop", "ter", ".", "ard", "upi", "lot", ".", "com", "/", "wiki", "/", "configura", "tion", "/", "ard", "uco", "pte", "r", "-", "parameter", "s", "/>", "`\\u", ",", "\\", "10", ";", " ", " ", " ", " ", "`", "Plan", "e", " ", "Parameter", "s", " ", "<", "http", "://", "plane", ".", "ard", "upi", "lot", ".", "com", "/", "wiki", "/", "ard", "up", "lan", "e-", "parameter", "s", "/>", "`\\u", ",", " ", "`", "Ro", "ver", " ", "Parameter", "s", " ", "<", "http", "://", "rov", "er", ".", "ard", "upi", "lot", ".", "com", "/", "wiki", "/", "ap", "mro", "ver", "2", "-", "parameter", "s", "/>", "`\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "code", " ", "fragment", " ", "belo", "w", " ", "show", "s", " ", "how", " ", "to", " ", "get", " ", "and", " ", "set", " ", "the", " ", "value", " ", "of", " ", "a", " ", "parameter", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Print", " ", "the", " ", "value", " ", "of", " ", "the", " ", "THR", "\\u", "MIN", " ", "parameter", ".", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Param", ":", " ", "%", "s", "\"", " ", "%", " ", "vehic", "le", ".", "parameter", "s", "['", "THR", "\\u", "MIN", "']", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Change", " ", "the", " ", "parameter", " ", "value", " ", "to", " ", "somet", "hing", " ", "different", ".", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "parameter", "s", "['", "THR", "\\u", "MIN", "']", "=", "100", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "is", " ", "als", "o", " ", "possib", "le", " ", "to", " ", "observe", " ", "parameter", "s", " ", "and", " ", "to", " ", "iterate", " ", "the", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "parameter", "s", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "more", " ", "informati", "on", " ", "see", " ", ":", "ref", ":`", "the", " ", "guide", " ", "<", "vehic", "le", "\\u", "state", "\\u", "parameter", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Parameters_", "(_", "collections_", "._", "Mut", "able", "Mapping_", ",_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "vehicle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Parameters_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "=_", "vehicle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parameters_", "(_", "collections_", "._", "Mut", "able", "Mapping_", ",_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "name_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wait", "\\u", "ready_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "params", "\\u", "map_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parameters_", "(_", "collections_", "._", "Mut", "able", "Mapping_", ",_", "Has", "Observer", "s_", ")_", ":_", "\\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_", ",_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "name_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wait", "\\u", "ready_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set_", "(_", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parameters_", "(_", "collections_", "._", "Mut", "able", "Mapping_", ",_", "Has", "Observer", "s_", ")_", ":_", "\\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_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "API", "Exception_", "(_", "'", "Cann", "ot", " ", "delete", " ", "value", " ", "from", " ", "parameter", "s", " ", "list", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parameters_", "(_", "collections_", "._", "Mut", "able", "Mapping_", ",_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "params", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parameters_", "(_", "collections_", "._", "Mut", "able", "Mapping_", ",_", "Has", "Observer", "s_", ")_", ":_", "\\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_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "params", "\\u", "map_", "._", "\\u\\u", "iter\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parameters_", "(_", "collections_", "._", "Mut", "able", "Mapping_", ",_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "name_", ",_", "wait", "\\u", "ready_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "name_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wait", "\\u", "ready_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wait", "\\u", "ready_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "params", "\\u", "map_", "._", "get_", "(_", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parameters_", "(_", "collections_", "._", "Mut", "able", "Mapping_", ",_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set_", "(_", "self_", ",_", "name_", ",_", "value_", ",_", "retries_", "=_", "3_", ",_", "wait", "\\u", "ready_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "wait", "\\u", "ready_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wait", "\\u", "ready_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "dumb", "ly", " ", "rei", "mple", "ment", " ", "this", " ", "usi", "ng", " ", "timeo", "ut", " ", "loops_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "we", " ", "shou", "ld", " ", "actual", "ly", " ", "be", " ", "await", "ing", " ", "an", " ", "AC", "K", " ", "of", " ", "PARAM", "\\u", "VALUE_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", "d", ",", " ", "but", " ", "we", " ", "don", "'", "t", " ", "have", " ", "a", " ", "proper", " ", "ack", " ", "structure", ",", " ", "we", "'", "ll_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inst", "ead", " ", "just", " ", "wait", " ", "unti", "l", " ", "the", " ", "value", " ", "its", "elf", " ", "was", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "name_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "float_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remaining_", "=_", "retries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "vehicle_", "._", "\\u", "master_", "._", "param", "\\u", "set\\u", "send_", "(_", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tstart", "_", "=_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "remaining_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remaining_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "-_", "tstart", "_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "in_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "params", "\\u", "map_", "and_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "params", "\\u", "map_", "[_", "name_", "]_", "==_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.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_", "retries_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "printer_", "(_", "\"", "timeo", "ut", " ", "setti", "ng", " ", "parameter", " ", "%", "s", " ", "to", " ", "%", "f", "\"_", "%_", "(_", "name_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parameters_", "(_", "collections_", "._", "Mut", "able", "Mapping_", ",_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wait", "\\u", "ready_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Block", " ", "the", " ", "calling", " ", "thread", " ", "unti", "l", " ", "parameter", "s", " ", "have", " ", "bee", "n", " ", "download", "ed", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "wait", "\\u", "ready_", "(_", "'", "parameter", "s", "'_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parameters_", "(_", "collections_", "._", "Mut", "able", "Mapping_", ",_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "attribute", "\\u", "listener_", "(_", "self_", ",_", "attr", "\\u", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "a", " ", "listen", "er", " ", "callback", " ", "on", " ", "a", " ", "partic", "ular", " ", "parameter", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "callback", " ", "can", " ", "be", " ", "remove", "d", " ", "usi", "ng", " ", ":", "py", ":", "func", ":`", "remove", "\\u", "attribute", "\\u", "listen", "er", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", ":", "py", ":", "func", ":`", "on", "\\u", "attribute", "`", " ", "decorat", "or", " ", "perform", "s", " ", "the", " ", "same", " ", "operati", "on", " ", "as", " ", "this", " ", "method", ",", " ", "but", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "more", " ", "ele", "gan", "t", " ", "synta", "x", ".", " ", "Us", "e", " ", "``", "add", "\\u", "attribute", "\\u", "listen", "er", "``", " ", "only", " ", "if", " ", "you", " ", "will", " ", "need", " ", "to", " ", "remove", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "observer", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "callback", " ", "function", " ", "is", " ", "invoke", "d", " ", "only", " ", "whe", "n", " ", "the", " ", "parameter", " ", "change", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "callback", " ", "argu", "ment", "s", " ", "are", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "self", "``", " ", "-", " ", "the", " ", "associate", "d", " ", ":", "py", ":", "class", ":`", "Parameter", "s", "`.", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "attr", "\\u", "name", "``", " ", "-", " ", "the", " ", "parameter", " ", "name", ".", " ", "Thi", "s", " ", "can", " ", "be", " ", "used", " ", "to", " ", "infer", " ", "whi", "ch", " ", "parameter", " ", "has", " ", "trigger", "ed", "\\", "10", ";", " ", " ", "if", " ", "the", " ", "same", " ", "callback", " ", "is", " ", "used", " ", "for", " ", "watch", "ing", " ", "multiple", " ", "parameter", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "msg", "``", " ", "-", " ", "the", " ", "new", " ", "parameter", " ", "value", " ", "(", "so", " ", "you", " ", "don", "'", "t", " ", "need", " ", "to", " ", "re", "-", "query", " ", "the", " ", "vehic", "le", " ", "object", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "example", " ", "belo", "w", " ", "show", "s", " ", "how", " ", "to", " ", "get", " ", "callback", "s", " ", "for", " ", "the", " ", "``", "THR", "\\u", "MIN", "``", " ", "parameter", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "Call", "back", " ", "function", " ", "for", " ", "the", " ", "THR", "\\u", "MIN", " ", "parameter", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "thr", "\\u", "min", "\\u", "callback", "(", "self", ",", " ", "attr", "\\u", "name", ",", " ", "value", "):", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", " ", "PARAMETER", " ", "CALL", "BACK", ":", " ", "%", "s", " ", "change", "d", " ", "to", ":", " ", "%", "s", "\"", " ", "%", " ", "(", "attr", "\\u", "name", ",", " ", "value", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "Add", " ", "observer", " ", "for", " ", "the", " ", "vehic", "le", "'", "s", " ", "THR", "\\u", "MIN", " ", "parameter", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "parameter", "s", ".", "add", "\\u", "attribute", "\\u", "listen", "er", "('", "THR", "\\u", "MIN", "',", " ", "thr", "\\u", "min", "\\u", "callback", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", ":", "ref", ":`", "vehic", "le", "\\u", "state", "\\u", "obs", "ervi", "ng", "\\u", "parameter", "s", "`", " ", "for", " ", "more", " ", "informati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "String", " ", "attr", "\\u", "name", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "parameter", " ", "to", " ", "watch", " ", "(", "or", " ", "'*", "'", " ", "to", " ", "watch", " ", "all", " ", "parameter", "s", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "args", ":", " ", "The", " ", "callback", " ", "to", " ", "invoke", " ", "whe", "n", " ", "a", " ", "change", " ", "in", " ", "the", " ", "parameter", " ", "is", " ", "detect", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attr", "\\u", "name_", "=_", "attr", "\\u", "name_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Parameters_", ",_", "self_", ")_", "._", "add", "\\u", "attribute", "\\u", "listener_", "(_", "attr", "\\u", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parameters_", "(_", "collections_", "._", "Mut", "able", "Mapping_", ",_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "attribute", "\\u", "listener_", "(_", "self_", ",_", "attr", "\\u", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Remove", " ", "a", " ", "pare", "mete", "r", " ", "listen", "er", " ", "tha", "t", " ", "was", " ", "previ", "ously", " ", "adde", "d", " ", "usi", "ng", " ", ":", "py", ":", "func", ":`", "add", "\\u", "attribute", "\\u", "listen", "er", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", " ", "to", " ", "remove", " ", "the", " ", "``", "thr", "\\u", "min", "\\u", "callback", "()``", " ", "callback", " ", "function", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", ".", "parameter", "s", ".", "remove", "\\u", "attribute", "\\u", "listen", "er", "('", "thr", "\\u", "min", "',", " ", "thr", "\\u", "min", "\\u", "callback", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", ":", "ref", ":`", "vehic", "le", "\\u", "state", "\\u", "obs", "ervi", "ng", "\\u", "parameter", "s", "`", " ", "for", " ", "more", " ", "informati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "String", " ", "attr", "\\u", "name", ":", " ", "The", " ", "parameter", " ", "name", " ", "tha", "t", " ", "is", " ", "to", " ", "have", " ", "an", " ", "observer", " ", "remove", "d", " ", "(", "or", " ", "'*", "'", " ", "to", " ", "remove", " ", "an", " ", "'", "all", " ", "attribute", "'", " ", "observer", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "args", ":", " ", "The", " ", "callback", " ", "function", " ", "to", " ", "remove", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attr", "\\u", "name_", "=_", "attr", "\\u", "name_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Parameters_", ",_", "self_", ")_", "._", "remove", "\\u", "attribute", "\\u", "listener_", "(_", "attr", "\\u", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parameters_", "(_", "collections_", "._", "Mut", "able", "Mapping_", ",_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "self_", ",_", "attr", "\\u", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attr", "\\u", "name_", "=_", "attr", "\\u", "name_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Parameters_", ",_", "self_", ")_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "attr", "\\u", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Parameters_", "(_", "collections_", "._", "Mut", "able", "Mapping_", ",_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "attribute_", "(_", "self_", ",_", "attr", "\\u", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Decorat", "or", " ", "for", " ", "parameter", " ", "listeners", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "There", " ", "is", " ", "no", " ", "way", " ", "to", " ", "remove", " ", "a", " ", "listen", "er", " ", "adde", "d", " ", "with", " ", "this", " ", "decorat", "or", ".", " ", "Us", "e", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "func", ":`", "add", "\\u", "attribute", "\\u", "listen", "er", "`", " ", "if", " ", "you", " ", "need", " ", "to", " ", "be", " ", "able", " ", "to", " ", "remove", "\\", "10", ";", " ", " ", " ", " ", "the", " ", ":", "py", ":", "func", ":`", "listen", "er", " ", "<", "remove", "\\u", "attribute", "\\u", "listen", "er", ">`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "callback", " ", "function", " ", "is", " ", "invoke", "d", " ", "only", " ", "whe", "n", " ", "the", " ", "parameter", " ", "change", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "callback", " ", "argu", "ment", "s", " ", "are", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "self", "``", " ", "-", " ", "the", " ", "associate", "d", " ", ":", "py", ":", "class", ":`", "Parameter", "s", "`.", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "attr", "\\u", "name", "``", " ", "-", " ", "the", " ", "parameter", " ", "name", ".", " ", "Thi", "s", " ", "can", " ", "be", " ", "used", " ", "to", " ", "infer", " ", "whi", "ch", " ", "parameter", " ", "has", " ", "trigger", "ed", "\\", "10", ";", " ", " ", "if", " ", "the", " ", "same", " ", "callback", " ", "is", " ", "used", " ", "for", " ", "watch", "ing", " ", "multiple", " ", "parameter", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "msg", "``", " ", "-", " ", "the", " ", "new", " ", "parameter", " ", "value", " ", "(", "so", " ", "you", " ", "don", "'", "t", " ", "need", " ", "to", " ", "re", "-", "query", " ", "the", " ", "vehic", "le", " ", "object", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "code", " ", "fragment", " ", "belo", "w", " ", "show", "s", " ", "how", " ", "to", " ", "get", " ", "callback", "s", " ", "for", " ", "the", " ", "``", "THR", "\\u", "MIN", "``", " ", "parameter", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "vehic", "le", ".", "parameter", "s", ".", "on", "\\u", "attribute", "('", "THR", "\\u", "MIN", "')", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "decorated", "\\u", "thr", "\\u", "min", "\\u", "callback", "(", "self", ",", " ", "attr", "\\u", "name", ",", " ", "value", "):", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", " ", "PARAMETER", " ", "CALL", "BACK", ":", " ", "%", "s", " ", "change", "d", " ", "to", ":", " ", "%", "s", "\"", " ", "%", " ", "(", "attr", "\\u", "name", ",", " ", "value", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", ":", "ref", ":`", "vehic", "le", "\\u", "state", "\\u", "obs", "ervi", "ng", "\\u", "parameter", "s", "`", " ", "for", " ", "more", " ", "informati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "String", " ", "attr", "\\u", "name", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "parameter", " ", "to", " ", "watch", " ", "(", "or", " ", "'*", "'", " ", "to", " ", "watch", " ", "all", " ", "parameter", "s", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "args", ":", " ", "The", " ", "callback", " ", "to", " ", "invoke", " ", "whe", "n", " ", "a", " ", "change", " ", "in", " ", "the", " ", "parameter", " ", "is", " ", "detect", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attr", "\\u", "name_", "=_", "attr", "\\u", "name_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Parameters_", ",_", "self_", ")_", "._", "on", "\\u", "attribute_", "(_", "attr", "\\u", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Command_", "(_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "Link", "\\u", "missio", "n", "\\u", "item", "\\u", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "waypoint", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "object", " ", "encodes", " ", "a", " ", "single", " ", "missio", "n", " ", "item", " ", "command", ".", " ", "The", " ", "set", " ", "of", " ", "command", "s", " ", "tha", "t", " ", "are", " ", "support", "ed", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "Ar", "du", "Pilo", "t", " ", "in", " ", "Cop", "ter", ",", " ", "Plan", "e", " ", "and", " ", "Ro", "ver", " ", "(", "along", " ", "with", " ", "thei", "r", " ", "parameter", "s", ")", " ", "are", " ", "liste", "d", " ", "in", " ", "the", " ", "wiki", " ", "article", "\\", "10", ";", " ", " ", " ", " ", "`", "MAV", "Link", " ", "Mission", " ", "Command", " ", "Messag", "es", " ", "(", "MAV", "\\u", "CMD", ")", " ", "<", "http", "://", "planner", ".", "ard", "upi", "lot", ".", "com", "/", "wiki", "/", "common", "-", "mavlink", "-", "missio", "n", "-", "command", "-", "message", "s", "-", "mav", "\\u", "cmd", "/>", "`\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "to", " ", "create", " ", "a", " ", "`", "NAV", "\\u", "WAY", "POINT", " ", "<", "http", "://", "planner", ".", "ard", "upi", "lot", ".", "com", "/", "wiki", "/", "common", "-", "mavlink", "-", "missio", "n", "-", "command", "-", "message", "s", "-", "mav", "\\u", "cmd", "/", "#", "mav", "\\u", "cmd", "\\u", "nav", "\\u", "waypoint", ">`\\u", " ", "command", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "cmd", " ", "=", " ", "Command", "(", "0", ",", "0", ",", "0", ",", " ", "mav", "util", ".", "mavlink", ".", "MAV", "\\u", "FRAME", "\\u", "GLOB", "AL", "\\u", "RELAT", "IV", "E", "\\u", "ALT", ",", "\\", "10", ";", " ", " ", " ", " ", "mav", "util", ".", "mavlink", ".", "MAV", "\\u", "CMD", "\\u", "NAV", "\\u", "WAY", "POINT", ",", " ", "0", ",", " ", "0", ",", " ", "0", ",", " ", "0", ",", " ", "0", ",", " ", "0", ",-", "34.", "364", "114", ",", " ", "149", ".1", "660", "2", "2", ",", " ", "30", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "target", "\\u", "system", ":", " ", "Thi", "s", " ", "can", " ", "be", " ", "set", " ", "to", " ", "any", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "(", "Dro", "ne", "Kit", " ", "change", "s", " ", "the", " ", "value", " ", "to", " ", "the", " ", "MAV", "Link", " ", "ID", " ", "of", " ", "the", " ", "connect", "ed", " ", "vehic", "le", " ", "bef", "ore", " ", "the", " ", "command", " ", "is", " ", "sent", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "target", "\\u", "component", ":", " ", "The", " ", "component", " ", "id", " ", "if", " ", "the", " ", "message", " ", "is", " ", "inten", "ded", " ", "for", " ", "a", " ", "partic", "ular", " ", "component", " ", "within", " ", "the", " ", "target", " ", "system", "\\", "10", ";", " ", " ", " ", " ", "(", "for", " ", "example", ",", " ", "the", " ", "came", "ra", ").", " ", "Set", " ", "to", " ", "zero", " ", "(", "broadcast", ")", " ", "in", " ", "most", " ", "case", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "seq", ":", " ", "The", " ", "sequence", " ", "number", " ", "within", " ", "the", " ", "missio", "n", " ", "(", "the", " ", "autop", "ilo", "t", " ", "will", " ", "reject", " ", "message", "s", " ", "sent", " ", "out", " ", "of", " ", "sequence", ").", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "shou", "ld", " ", "be", " ", "set", " ", "to", " ", "zero", " ", "as", " ", "the", " ", "API", " ", "will", " ", "automati", "call", "y", " ", "set", " ", "the", " ", "correct", " ", "value", " ", "whe", "n", " ", "upload", "ing", " ", "a", " ", "missio", "n", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "frame", ":", " ", "The", " ", "frame", " ", "of", " ", "reference", " ", "used", " ", "for", " ", "the", " ", "location", " ", "parameter", "s", " ", "(", "x", ",", " ", "y", ",", " ", "z", ").", " ", "In", " ", "most", " ", "case", "s", " ", "this", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "``", "mav", "util", ".", "mavlink", ".", "MAV", "\\u", "FRAME", "\\u", "GLOB", "AL", "\\u", "RELAT", "IV", "E", "\\u", "ALT", "``", ",", " ", "whi", "ch", " ", "use", "s", " ", "the", " ", "WG", "S", "84", " ", "global", " ", "coordinate", " ", "system", " ", "for", " ", "latitude", " ", "and", " ", "longitude", ",", " ", "but", " ", "sets", " ", "alti", "tude", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "relative", " ", "to", " ", "the", " ", "home", " ", "position", " ", "in", " ", "metre", "s", " ", "(", "home", " ", "alti", "tude", " ", "=", " ", "0", ").", " ", "For", " ", "more", " ", "informati", "on", " ", "`", "see", " ", "the", " ", "wiki", " ", "here", "\\", "10", ";", " ", " ", " ", " ", "<", "http", "://", "planner", ".", "ard", "upi", "lot", ".", "com", "/", "wiki", "/", "common", "-", "mavlink", "-", "missio", "n", "-", "command", "-", "message", "s", "-", "mav", "\\u", "cmd", "/", "#", "frames", "\\u", "of", "\\u", "reference", ">`\\u", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "command", ":", " ", "The", " ", "specific", " ", "missio", "n", " ", "command", " ", "(", "e", ".", "g", ".", " ", "``", "mav", "util", ".", "mavlink", ".", "MAV", "\\u", "CMD", "\\u", "NAV", "\\u", "WAY", "POINT", "``)", ".", " ", "The", " ", "support", "ed", " ", "command", "s", " ", "(", "and", " ", "command", " ", "parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "liste", "d", " ", "`", "on", " ", "the", " ", "wiki", " ", "<", "http", "://", "planner", ".", "ard", "upi", "lot", ".", "com", "/", "wiki", "/", "common", "-", "mavlink", "-", "missio", "n", "-", "command", "-", "message", "s", "-", "mav", "\\u", "cmd", "/>", "`\\u", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "current", ":", " ", "Set", " ", "to", " ", "zero", " ", "(", "not", " ", "support", "ed", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "autocon", "tin", "ue", ":", " ", "Set", " ", "to", " ", "zero", " ", "(", "not", " ", "support", "ed", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "param", "1", ":", " ", "Command", " ", "specific", " ", "parameter", " ", "(", "depend", "s", " ", "on", " ", "specific", " ", "`", "Mission", " ", "Command", " ", "(", "MAV", "\\u", "CMD", ")", " ", "<", "http", "://", "planner", ".", "ard", "upi", "lot", ".", "com", "/", "wiki", "/", "common", "-", "mavlink", "-", "missio", "n", "-", "command", "-", "message", "s", "-", "mav", "\\u", "cmd", "/>", "`\\u", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "param", "2", ":", " ", "Command", " ", "specific", " ", "parameter", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "param", "3", ":", " ", "Command", " ", "specific", " ", "parameter", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "param", "4", ":", " ", "Command", " ", "specific", " ", "parameter", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "x", ":", " ", "(", "param", "5", ")", " ", "Command", " ", "specific", " ", "parameter", " ", "used", " ", "for", " ", "latitude", " ", "(", "if", " ", "rele", "van", "t", " ", "to", " ", "command", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "y", ":", " ", "(", "param", "6", ")", " ", "Command", " ", "specific", " ", "parameter", " ", "used", " ", "for", " ", "longitude", " ", "(", "if", " ", "rele", "van", "t", " ", "to", " ", "command", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "z", ":", " ", "(", "param", "7", ")", " ", "Command", " ", "specific", " ", "parameter", " ", "used", " ", "for", " ", "alti", "tude", " ", "(", "if", " ", "rele", "van", "t", ").", " ", "The", " ", "reference", " ", "frame", " ", "for", " ", "alti", "tude", " ", "depend", "s", " ", "on", " ", "the", " ", "``", "frame", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Command", "Sequence_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "sequence", " ", "of", " ", "vehic", "le", " ", "waypoints", " ", "(", "a", " ", "\"", "missio", "n", "\")", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Opera", "tion", "s", " ", "include", " ", "'", "array", " ", "style", "'", " ", "indexe", "d", " ", "access", " ", "to", " ", "the", " ", "vari", "ous", " ", "contain", "ed", " ", "waypoints", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "current", " ", "command", "s", "/", "missio", "n", " ", "for", " ", "a", " ", "vehic", "le", " ", "are", " ", "accesse", "d", " ", "usi", "ng", " ", "the", " ", ":", "py", ":", "attr", ":`", "Vehicle", ".", "command", "s", "`", " ", "attribute", ".", "\\", "10", ";", " ", " ", " ", " ", "Way", "points", " ", "are", " ", "not", " ", "download", "ed", " ", "from", " ", "vehic", "le", " ", "unti", "l", " ", ":", "py", ":", "func", ":`", "download", "()`", " ", "is", " ", "call", "ed", ".", " ", " ", "The", " ", "download", " ", "is", " ", "async", "hronous", ";", "\\", "10", ";", " ", " ", " ", " ", "use", " ", ":", "py", ":", "func", ":`", "wait", "\\u", "read", "y", "()`", " ", "to", " ", "block", " ", "your", " ", "thread", " ", "unti", "l", " ", "the", " ", "download", " ", "is", " ", "complete", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "code", " ", "to", " ", "download", " ", "the", " ", "command", "s", " ", "from", " ", "a", " ", "vehic", "le", " ", "is", " ", "shown", " ", "belo", "w", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", " ", " ", " ", " ", ":", "empha", "size", "-", "lines", ":", " ", "5", "-1", "0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", "Connect", " ", "to", " ", "a", " ", "vehic", "le", " ", "object", " ", "(", "for", " ", "example", ",", " ", "on", " ", "com", "14", ")", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", " ", "=", " ", "connect", "('", "com", "14", "',", " ", "wait", "\\u", "read", "y", "=", "Tru", "e", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Down", "load", " ", "the", " ", "vehic", "le", " ", "waypoints", " ", "(", "command", "s", ").", " ", "Wait", " ", "unti", "l", " ", "download", " ", "is", " ", "complete", ".", "\\", "10", ";", " ", " ", " ", " ", "cmds", " ", "=", " ", "vehic", "le", ".", "command", "s", "\\", "10", ";", " ", " ", " ", " ", "cmds", ".", "download", "()", "\\", "10", ";", " ", " ", " ", " ", "cmds", ".", "wait", "\\u", "read", "y", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "set", " ", "of", " ", "command", "s", " ", "can", " ", "be", " ", "change", "d", " ", "and", " ", "uploade", "d", " ", "to", " ", "the", " ", "client", ".", " ", "The", " ", "change", "s", " ", "are", " ", "not", " ", "guaran", "tee", "d", " ", "to", " ", "be", " ", "complete", " ", "unti", "l", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "func", ":`", "upload", "()", " ", "<", "Vehicle", ".", "command", "s", ".", "upload", ">`", " ", "is", " ", "call", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "cmds", " ", "=", " ", "vehic", "le", ".", "command", "s", "\\", "10", ";", " ", " ", " ", " ", "cmds", ".", "clear", "()", "\\", "10", ";", " ", " ", " ", " ", "lat", " ", "=", " ", "-", "34.", "364", "114", ",", "\\", "10", ";", " ", " ", " ", " ", "lon", " ", "=", " ", "149", ".1", "660", "2", "2", "\\", "10", ";", " ", " ", " ", " ", "alti", "tude", " ", "=", " ", "30.", "0", "\\", "10", ";", " ", " ", " ", " ", "cmd", " ", "=", " ", "Command", "(", "0", ",", "0", ",", "0", ",", " ", "mav", "util", ".", "mavlink", ".", "MAV", "\\u", "FRAME", "\\u", "GLOB", "AL", "\\u", "RELAT", "IV", "E", "\\u", "ALT", ",", " ", "mav", "util", ".", "mavlink", ".", "MAV", "\\u", "CMD", "\\u", "NAV", "\\u", "WAY", "POINT", ",", "\\", "10", ";", " ", " ", " ", " ", "0", ",", " ", "0", ",", " ", "0", ",", " ", "0", ",", " ", "0", ",", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "lat", ",", " ", "lon", ",", " ", "alti", "tude", ")", "\\", "10", ";", " ", " ", " ", " ", "cmds", ".", "add", "(", "cmd", ")", "\\", "10", ";", " ", " ", " ", " ", "cmds", ".", "upload", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "class_", "Command", "Sequence_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "vehicle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "vehicle_", "=_", "vehicle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Command", "Sequence_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "download_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Down", "load", " ", "all", " ", "waypoints", " ", "from", " ", "the", " ", "vehic", "le", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "download", " ", "is", " ", "async", "hronous", ".", " ", "Us", "e", " ", ":", "py", ":", "func", ":`", "wait", "\\u", "read", "y", "()`", " ", "to", " ", "block", " ", "your", " ", "thread", " ", "unti", "l", " ", "the", " ", "download", " ", "is", " ", "complete", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wait", "\\u", "ready_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "read", "y", "\\u", "attrs_", "._", "remove_", "(_", "'", "command", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wp", "\\u", "loaded_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "master_", "._", "waypoint", "\\u", "request", "\\u", "list", "\\u", "send_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "BIG", " ", "FIX", "ME", " ", "-", " ", "wait", " ", "for", " ", "full", " ", "wpt", " ", "download", " ", "bef", "ore", " ", "allow", "ing", " ", "any", " ", "of", " ", "the", " ", "accessor", "s", " ", "to", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Command", "Sequence_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wait", "\\u", "ready_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Block", " ", "the", " ", "calling", " ", "thread", " ", "unti", "l", " ", "waypoints", " ", "have", " ", "bee", "n", " ", "download", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "call", "ed", " ", "after", " ", ":", "py", ":", "func", ":`", "download", "()`", " ", "to", " ", "block", " ", "the", " ", "thread", " ", "unti", "l", " ", "the", " ", "async", "hronous", " ", "download", " ", "is", " ", "complete", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "vehicle_", "._", "wait", "\\u", "ready_", "(_", "'", "command", "s", "'_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Command", "Sequence_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Clear", " ", "the", " ", "command", " ", "list", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "command", " ", "will", " ", "be", " ", "sent", " ", "to", " ", "the", " ", "vehic", "le", " ", "only", " ", "after", " ", "you", " ", "call", " ", ":", "py", ":", "func", ":`", "upload", "()", " ", "<", "Vehicle", ".", "command", "s", ".", "upload", ">`", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "home", " ", "point", " ", "again", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wait", "\\u", "ready_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "home_", "=_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wp", "loader_", "._", "wp_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wp", "loader_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "home_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wp", "loader_", "._", "add_", "(_", "home_", ",_", "comment_", "=_", "'", "Added", " ", "by", " ", "Dro", "ne", "Kit", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wpt", "s", "\\u", "dirty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Command", "Sequence_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add_", "(_", "self_", ",_", "cmd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "a", " ", "new", " ", "command", " ", "(", "waypoint", ")", " ", "at", " ", "the", " ", "end", " ", "of", " ", "the", " ", "command", " ", "list", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Command", "s", " ", "are", " ", "sent", " ", "to", " ", "the", " ", "vehic", "le", " ", "only", " ", "after", " ", "you", " ", "call", " ", "::", "py", ":", "func", ":`", "upload", "()", " ", "<", "Vehicle", ".", "command", "s", ".", "upload", ">`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "Command", " ", "cmd", ":", " ", "The", " ", "command", " ", "to", " ", "be", " ", "adde", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wait", "\\u", "ready_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "handler_", "._", "fix", "\\u", "targets_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wp", "loader_", "._", "add_", "(_", "cmd_", ",_", "comment_", "=_", "'", "Added", " ", "by", " ", "Dro", "ne", "Kit", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wpt", "s", "\\u", "dirty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Command", "Sequence_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "upload_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Call", " ", "``", "upload", "()``", " ", "after", " ", ":", "py", ":", "func", ":`", "addin", "g", " ", "<", "Command", "Sequ", "ence", ".", "add", ">`", " ", "or", " ", ":", "py", ":", "func", ":`", "clear", "ing", " ", "<", "Command", "Sequ", "ence", ".", "clear", ">`", " ", "missio", "n", " ", "command", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Af", "ter", " ", "the", " ", "return", " ", "from", " ", "``", "upload", "()``", " ", "any", " ", "writes", " ", "are", " ", "guaran", "tee", "d", " ", "to", " ", "have", " ", "complete", "d", " ", "(", "or", " ", "throw", "n", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "exception", ")", " ", "and", " ", "future", " ", "reads", " ", "will", " ", "see", " ", "thei", "r", " ", "effect", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wpt", "s", "\\u", "dirty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "vehicle_", "._", "\\u", "master_", "._", "waypoint", "\\u", "clear", "\\u", "all", "\\u", "send_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wp", "loader_", "._", "count_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wp", "\\u", "uploade", "d_", "=_", "[_", "False_", "]_", "*_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wp", "loader_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "master_", "._", "waypoint", "\\u", "count", "\\u", "send_", "(_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wp", "loader_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "False_", "in_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wp", "\\u", "uploade", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wp", "\\u", "uploade", "d_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wpt", "s", "\\u", "dirty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Command", "Sequence_", "(_", "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_", "def_", "count_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "number", " ", "of", " ", "waypoints", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "The", " ", "number", " ", "of", " ", "waypoints", " ", "in", " ", "the", " ", "sequence", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "max_", "(_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wp", "loader_", "._", "count_", "(_", ")_", "-_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Command", "Sequence_", "(_", "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_", "def_", "next_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "currentl", "y", " ", "active", " ", "waypoint", " ", "number", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "current", "\\u", "waypoint", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Command", "Sequence_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "next_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "next_", "(_", "self_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "a", " ", "new", " ", "``", "next", "``", " ", "waypoint", " ", "for", " ", "the", " ", "vehic", "le", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "master_", "._", "waypoint", "\\u", "set\\u", "current", "\\u", "send_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Command", "Sequence_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "number", " ", "of", " ", "waypoints", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "The", " ", "number", " ", "of", " ", "waypoints", " ", "in", " ", "the", " ", "sequence", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "max_", "(_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wp", "loader_", "._", "count_", "(_", ")_", "-_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Command", "Sequence_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "index_", ",_", "slice_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "self_", "[_", "ii_", "]_", "for_", "ii_", "in_", "xrange_", "(_", "*_", "index_", "._", "indices_", "(_", "len_", "(_", "self_", ")_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "index_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wp", "loader_", "._", "wp_", "(_", "index_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "item_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Index", "Error_", "(_", "'", "Index", " ", "%", "s", " ", "out", " ", "of", " ", "range", ".'_", "%_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "item_", "\\u\\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", "lid", " ", "argu", "ment", " ", "type", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Command", "Sequence_", "(_", "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", "setitem\\u\\u_", "(_", "self_", ",_", "index_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wp", "loader_", "._", "set_", "(_", "value_", ",_", "index_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehicle_", "._", "\\u", "wpt", "s", "\\u", "dirty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "connect_", "(_", "ip_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "initialize_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wait", "\\u", "ready_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status", "\\u", "printer_", "=_", "err", "printer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vehic", "le", "\\u", "class_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rate_", "=_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "baud", "_", "=_", "1152", "00_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "heart", "beat", "\\u", "timeout_", "=_", "30_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "system_", "=_", "255_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "native_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", ":", "py", ":", "class", ":`", "Vehicle", "`", " ", "object", " ", "connect", "ed", " ", "to", " ", "the", " ", "address", " ", "specified", " ", "by", " ", "string", " ", "parameter", " ", "``", "ip", "``.", "\\", "10", ";", " ", " ", " ", " ", "Connect", "ion", " ", "string", " ", "parameter", "s", " ", "(", "``", "ip", "``)", " ", "for", " ", "different", " ", "target", "s", " ", "are", " ", "liste", "d", " ", "in", " ", "the", " ", ":", "ref", ":`", "getti", "ng", " ", "start", "ed", " ", "guide", " ", "<", "get", "\\u", "start", "ed", "\\u", "connecti", "ng", ">`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "method", " ", "is", " ", "usual", "ly", " ", "call", "ed", " ", "with", " ", "``", "wait", "\\u", "read", "y", "=", "Tru", "e", "``", " ", "to", " ", "ensure", " ", "tha", "t", " ", "vehic", "le", " ", "parameter", "s", " ", "and", " ", "(", "most", ")", " ", "attribute", "s", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "avail", "able", " ", "whe", "n", " ", "``", "connect", "()``", " ", "return", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "drone", "kit", " ", "import", " ", "connect", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Connect", " ", "to", " ", "the", " ", "Vehicle", " ", "usi", "ng", " ", "\"", "connecti", "on", " ", "string", "\"", " ", "(", "in", " ", "this", " ", "case", " ", "an", " ", "address", " ", "on", " ", "network", ")", "\\", "10", ";", " ", " ", " ", " ", "vehic", "le", " ", "=", " ", "connect", "('", "127", ".0", ".0", ".1", ":", "145", "50", "',", " ", "wait", "\\u", "read", "y", "=", "Tru", "e", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "String", " ", "ip", ":", " ", ":", "ref", ":`", "Connect", "ion", " ", "string", " ", "<", "get", "\\u", "start", "ed", "\\u", "connecti", "ng", ">`", " ", "for", " ", "target", " ", "address", " ", "-", " ", "e", ".", "g", ".", " ", "127", ".0", ".0", ".1", ":", "145", "50.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "Boo", "l", "/", "Array", " ", "wait", "\\u", "read", "y", ":", " ", "If", " ", "``", "Tru", "e", "``", " ", "wait", " ", "unti", "l", " ", "all", " ", "default", " ", "attribute", "s", " ", "have", " ", "download", "ed", " ", "bef", "ore", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "method", " ", "return", "s", " ", "(", "default", " ", "is", " ", "``", "Non", "e", "``)", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "attribute", "s", " ", "to", " ", "wait", " ", "on", " ", "are", ":", " ", ":", "py", ":", "attr", ":`", "parameter", "s", "`", ",", " ", ":", "py", ":", "attr", ":`", "gps", "\\u", "0", "`", ",", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "attr", ":`", "arme", "d", "`", ",", " ", ":", "py", ":", "attr", ":`", "mode", "`", ",", " ", "and", " ", ":", "py", ":", "attr", ":`", "atti", "tude", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "als", "o", " ", "speci", "fy", " ", "a", " ", "named", " ", "set", " ", "of", " ", "parameter", "s", " ", "to", " ", "wait", " ", "on", " ", "(", "e", ".", "g", ".", " ", "``", "wait", "\\u", "read", "y", "=[", "'", "system", "\\u", "status", "','", "mode", "']", "``)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "more", " ", "informati", "on", " ", "see", " ", ":", "py", ":", "func", ":`", "Vehicle", ".", "wait", "\\u", "read", "y", " ", "<", "Vehicle", ".", "wait", "\\u", "read", "y", ">`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "status", "\\u", "printer", ":", " ", "Meth", "od", " ", "of", " ", "signa", "ture", " ", "``", "def", " ", "status", "\\u", "printer", "(", "txt", ")`", "`", " ", "tha", "t", " ", "print", "s", "\\", "10", ";", " ", " ", " ", " ", "STATUS", "\\u", "TEXT", " ", "message", "s", " ", "from", " ", "the", " ", "Vehicle", " ", "and", " ", "other", " ", "diagnostic", " ", "informati", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "default", " ", "the", " ", "status", " ", "informati", "on", " ", "is", " ", "printed", " ", "to", " ", "the", " ", "command", " ", "prompt", " ", "in", " ", "whi", "ch", " ", "the", " ", "script", " ", "is", " ", "runn", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "Vehicle", " ", "vehic", "le", "\\u", "class", ":", " ", "The", " ", "class", " ", "tha", "t", " ", "will", " ", "be", " ", "instantiate", "d", " ", "by", " ", "the", " ", "``", "connect", "()``", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "any", " ", "sub", "-", "class", " ", "of", " ", "``", "Vehicle", "``", " ", "(", "and", " ", "default", "s", " ", "to", " ", "``", "Vehicle", "``)", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "int", " ", "rate", ":", " ", "Data", " ", "stream", " ", "refre", "sh", " ", "rate", ".", " ", "The", " ", "default", " ", "is", " ", "4", "H", "z", " ", "(", "4", " ", "update", "s", " ", "per", " ", "second", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "int", " ", "baud", ":", " ", "The", " ", "baud", " ", "rate", " ", "for", " ", "the", " ", "connecti", "on", ".", " ", "The", " ", "default", " ", "is", " ", "1152", "00", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "int", " ", "heart", "beat", "\\u", "timeo", "ut", ":", " ", "Connect", "ion", " ", "timeo", "ut", " ", "value", " ", "in", " ", "second", "s", " ", "(", "default", " ", "is", " ", "30", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "a", " ", "heart", "beat", " ", "is", " ", "not", " ", "detect", "ed", " ", "within", " ", "this", " ", "time", " ", "an", " ", "exception", " ", "will", " ", "be", " ", "raise", "d", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "int", " ", "source", "\\u", "system", ":", " ", "The", " ", "MAV", "Link", " ", "ID", " ", "of", " ", "the", " ", ":", "py", ":", "class", ":`", "Vehicle", "`", " ", "object", " ", "return", "ed", " ", "by", " ", "this", " ", "method", " ", "(", "by", " ", "default", " ", "255", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "bool", " ", "use", "\\u", "nativ", "e", ":", " ", "Us", "e", " ", "precom", "pile", "d", " ", "MAV", "Link", " ", "parser", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "return", "ed", " ", ":", "py", ":", "class", ":`", "Vehicle", "`", " ", "object", " ", "acts", " ", "as", " ", "a", " ", "ground", " ", "control", " ", "station", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "perspective", " ", "of", " ", "the", " ", "connect", "ed", " ", "\"", "real", "\"", " ", "vehic", "le", ".", " ", "It", " ", "will", " ", "process", "/", "receive", " ", "message", "s", " ", "from", " ", "the", " ", "real", " ", "vehic", "le", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "the", "y", " ", "are", " ", "addresse", "d", " ", "to", " ", "this", " ", "``", "source", "\\u", "system", "``", " ", "id", ".", " ", "Messag", "es", " ", "sent", " ", "to", " ", "the", " ", "real", " ", "vehic", "le", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "automati", "call", "y", " ", "update", "d", " ", "to", " ", "use", " ", "the", " ", "vehic", "le", "'", "s", " ", "``", "target", "\\u", "system", "``", " ", "id", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "is", " ", "*", "good", " ", "practic", "e", "*", " ", "to", " ", "assign", " ", "a", " ", "unique", " ", "id", " ", "for", " ", "every", " ", "system", " ", "on", " ", "the", " ", "MAV", "Link", " ", "network", ".", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "is", " ", "possib", "le", " ", "to", " ", "configur", "e", " ", "the", " ", "autop", "ilo", "t", " ", "to", " ", "only", " ", "respond", " ", "to", " ", "guide", "d", "-", "mode", " ", "command", "s", " ", "from", " ", "a", " ", "specified", " ", "GC", "S", " ", "ID", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "A", " ", "connect", "ed", " ", "vehic", "le", " ", "of", " ", "the", " ", "type", " ", "defin", "ed", " ", "in", " ", "``", "vehic", "le", "\\u", "class", "``", " ", "(", "a", " ", "superclass", " ", "of", " ", ":", "py", ":", "class", ":`", "Vehicle", "`)", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "vehic", "le", "\\u", "class_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vehic", "le", "\\u", "class_", "=_", "Vehicle", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "handler_", "=_", "MAV", "Connection_", "(_", "ip_", ",_", "baud", "_", "=_", "baud", "_", ",_", "source", "\\u", "system_", "=_", "source", "\\u", "system_", ",_", "use", "\\u", "native_", "=_", "use", "\\u", "native_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vehicle_", "=_", "vehic", "le", "\\u", "class_", "(_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "status", "\\u", "printer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "vehicle_", "._", "on", "\\u", "message_", "(_", "'", "STATUS", "TEXT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "printer_", "(_", "re_", "._", "sub_", "(_", "r", "'(", "^", "|\\\\", "n", ")'_", ",_", "'>>", ">", " ", "'_", ",_", "m_", "._", "text_", "._", "rstrip_", "(_", ")_", ")_", ")_", "\\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", "initialize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vehicle_", "._", "initialize_", "(_", "rate_", "=_", "rate_", ",_", "heart", "beat", "\\u", "timeout_", "=_", "heart", "beat", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "wait", "\\u", "ready_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "wait", "\\u", "ready_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vehicle_", "._", "wait", "\\u", "ready_", "(_", "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 ", " _", "vehicle_", "._", "wait", "\\u", "ready_", "(_", "*_", "wait", "\\u", "ready_", ")_", "\\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_", "vehicle_" ]
[ 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, 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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 ]
Except block handles 'BaseException'
fp7-ofelia/ocf/expedient/src/python/expedient/clearinghouse/users/models.py
[ { "content": " def __unicode__(self):\n try:\n return \"Profile for %s\" % self.user\n except:\n return \"No user\"", "metadata": "root.UserProfile.__unicode__", "header": "['class', 'UserProfile', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 22 } ]
[ { "span": "except:", "start_line": 25, "start_column": 8, "end_line": 25, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "User", "Profile_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Profil", "e", " ", "for", " ", "%", "s", "\"_", "%_", "self_", "._", "user_", "\\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_", "\"", "No", " ", "user", "\"_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
olemb/dbfread/dbfread/dbf.py
[ { "content": "\"\"\"\nClass to read DBF files.\n\"\"\"\nimport os\nimport sys\nimport datetime\nimport collections\n\nfrom .ifiles import ifind\nfrom .struct_parser import StructParser\nfrom .field_parser import FieldParser\nfrom .memo import find_memofile, open_memofile, FakeMemoFile, BinaryMemo\nfrom .codepages import guess_encoding\nfrom .dbversions import get_dbversion_string\nfrom .exceptions import *\n\nDBFHeader = StructParser(\n 'DBFHeader',\n '<BBBBLHHHBBLLLBBH',\n ['dbversion',\n 'year',\n 'month',\n 'day',\n 'numrecords',\n 'headerlen',\n 'recordlen',\n 'reserved1',\n 'incomplete_transaction',\n 'encryption_flag',\n 'free_record_thread',\n 'reserved2',\n 'reserved3',\n 'mdx_flag',\n 'language_driver',\n 'reserved4',\n ])\n\nDBFField = StructParser(\n 'DBFField',\n '<11scLBBHBBBB7sB',\n ['name',\n 'type',\n 'address',\n 'length',\n 'decimal_count',\n 'reserved1',\n 'workarea_id',\n 'reserved2',\n 'reserved3',\n 'set_fields_flag',\n 'reserved4',\n 'index_field_flag',\n ])\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def expand_year(year):\n \"\"\"Convert 2-digit year to 4-digit year.\"\"\"\n \n if year < 80:\n return 2000 + year\n else:\n return 1900 + year", "metadata": "root.expand_year", "header": "['module', '___EOS___']", "index": 55 }, { "content": "class RecordIterator(object):\n\n ", "metadata": "root.RecordIterator", "header": "['module', '___EOS___']", "index": 64 }, { "content": " def __init__(self, table, record_type):\n self._record_type = record_type\n self._table = table", "metadata": "root.RecordIterator.__init__", "header": "['class', 'RecordIterator', '(', 'object', ')', ':', '___EOS___']", "index": 65 }, { "content": " def __iter__(self):\n return self._table._iter_records(self._record_type)", "metadata": "root.RecordIterator.__iter__", "header": "['class', 'RecordIterator', '(', 'object', ')', ':', '___EOS___']", "index": 69 }, { "content": " def __len__(self):\n return self._table._count_records(self._record_type)", "metadata": "root.RecordIterator.__len__", "header": "['class', 'RecordIterator', '(', 'object', ')', ':', '___EOS___']", "index": 72 }, { "content": "class DBF(object):\n \"\"\"DBF table.\"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.DBF", "header": "['module', '___EOS___']", "index": 76 }, { "content": " def __init__(self, filename, encoding=None, ignorecase=True,\n lowernames=False,\n parserclass=FieldParser,\n recfactory=collections.OrderedDict,\n load=False,\n raw=False,\n ignore_missing_memofile=False):\n\n self.encoding = encoding\n self.ignorecase = ignorecase\n self.lowernames = lowernames\n self.parserclass = parserclass\n self.raw = raw\n self.ignore_missing_memofile = ignore_missing_memofile\n\n if recfactory is None:\n self.recfactory = lambda items: items\n else:\n self.recfactory = recfactory\n\n # Name part before .dbf is the table name\n self.name = os.path.basename(filename)\n self.name = os.path.splitext(self.name)[0].lower()\n self._records = None\n self._deleted = None\n\n if ignorecase:\n self.filename = ifind(filename)\n if not self.filename:\n raise DBFNotFound('could not find file {!r}'.format(filename))\n else:\n self.filename = filename\n\n # Filled in by self._read_headers()\n self.memofilename = None\n self.header = None\n self.fields = [] # namedtuples\n self.field_names = [] # strings\n\n with open(self.filename, mode='rb') as infile:\n self._read_header(infile)\n self._read_field_headers(infile)\n self._check_headers()\n \n try:\n self.date = datetime.date(expand_year(self.header.year),\n self.header.month,\n self.header.day)\n except ValueError:\n # Invalid date or '\\x00\\x00\\x00'.\n self.date = None\n \n self.memofilename = self._get_memofilename()\n\n if load:\n self.load()", "metadata": "root.DBF.__init__", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 78 }, { "content": " @property\n def dbversion(self):\n return get_dbversion_string(self.header.dbversion)", "metadata": "root.DBF.dbversion", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 135 }, { "content": " def _get_memofilename(self):\n # Does the table have a memo field?\n field_types = [field.type for field in self.fields]\n if not set(field_types) & set('MGPB'):\n # No memo fields.\n return None\n\n path = find_memofile(self.filename)\n if path is None:\n if self.ignore_missing_memofile:\n return None\n raise MissingMemoFile('missing memo file for {}'.format(\n self.filename))\n else:\n return path", "metadata": "root.DBF._get_memofilename", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 139 }, { "content": " @property\n def loaded(self):\n \"\"\"``True`` if records are loaded into memory.\"\"\"\n return self._records is not None", "metadata": "root.DBF.loaded", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 155 }, { "content": " def load(self):\n \"\"\"Load records into memory.\n\n This loads both records and deleted records. The ``records``\n and ``deleted`` attributes will now be lists of records.\n\n \"\"\"\n if not self.loaded:\n self._records = list(self._iter_records(b' '))\n self._deleted = list(self._iter_records(b'*'))", "metadata": "root.DBF.load", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 160 }, { "content": " def unload(self):\n \"\"\"Unload records from memory.\n\n The records and deleted attributes will now be instances of\n ``RecordIterator``, which streams records from disk.\n \"\"\"\n self._records = None\n self._deleted = None", "metadata": "root.DBF.unload", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 171 }, { "content": " @property\n def records(self):\n \"\"\"Records (not included deleted ones). When loaded a list of records,\n when not loaded a new ``RecordIterator`` object.\n \"\"\"\n if self.loaded:\n return self._records\n else:\n return RecordIterator(self, b' ')", "metadata": "root.DBF.records", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 180 }, { "content": " @property\n def deleted(self):\n \"\"\"Deleted records. When loaded a list of records, when not loaded a\n new ``RecordIterator`` object.\n \"\"\"\n if self.loaded:\n return self._deleted\n else:\n return RecordIterator(self, b'*')", "metadata": "root.DBF.deleted", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 190 }, { "content": " def _read_header(self, infile):\n # Todo: more checks?\n self.header = DBFHeader.read(infile)\n\n if self.encoding is None:\n try:\n self.encoding = guess_encoding(self.header.language_driver)\n except LookupError as err:\n self.encoding = 'ascii'", "metadata": "root.DBF._read_header", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 200 }, { "content": " def _read_field_headers(self, infile):\n while True:\n sep = infile.read(1)\n if sep in (b'\\r', b'\\n', b''):\n # End of field headers\n break\n\n field = DBFField.unpack(sep + infile.read(DBFField.size - 1))\n\n field.type = chr(ord(field.type))\n\n # Field name is b'\\0' terminated.\n field.name = field.name.split(b'\\0')[0].decode(self.encoding)\n if self.lowernames:\n field.name = field.name.lower()\n\n self.field_names.append(field.name)\n\n self.fields.append(field)", "metadata": "root.DBF._read_field_headers", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 210 }, { "content": " def _open_memofile(self):\n if self.memofilename and not self.raw:\n return open_memofile(self.memofilename, self.header.dbversion)\n else:\n return FakeMemoFile(self.memofilename)", "metadata": "root.DBF._open_memofile", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 230 }, { "content": " def _check_headers(self):\n field_parser = self.parserclass(self)\n\n \"\"\"Check headers for possible format errors.\"\"\"\n for field in self.fields:\n\n if field.type == 'I' and field.length != 4:\n message = 'Field type I must have length 4 (was {})'\n raise ValueError(message.format(field.length))\n\n elif field.type == 'L' and field.length != 1:\n message = 'Field type L must have length 1 (was {})'\n raise ValueError(message.format(field.length))\n\n elif not field_parser.field_type_supported(field.type):\n # Todo: return as byte string?\n raise ValueError('Unknown field type: {!r}'.format(field.type))", "metadata": "root.DBF._check_headers", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 236 }, { "content": " def _skip_record(self, infile):\n # -1 for the record separator which was already read.\n infile.seek(self.header.recordlen - 1, 1)", "metadata": "root.DBF._skip_record", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 254 }, { "content": " def _count_records(self, record_type=b' '):\n count = 0\n\n with open(self.filename, 'rb') as infile:\n # Skip to first record.\n infile.seek(self.header.headerlen, 0)\n\n while True:\n sep = infile.read(1)\n if sep == record_type:\n count += 1\n self._skip_record(infile)\n elif sep in (b'\\x1a', b''):\n # End of records.\n break\n else:\n self._skip_record(infile)\n\n return count", "metadata": "root.DBF._count_records", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 258 }, { "content": " def _iter_records(self, record_type=b' '):\n with open(self.filename, 'rb') as infile, \\\n self._open_memofile() as memofile:\n\n # Skip to first record.\n infile.seek(self.header.headerlen, 0)\n\n if not self.raw:\n field_parser = self.parserclass(self, memofile)\n parse = field_parser.parse\n\n # Shortcuts for speed.\n skip_record = self._skip_record\n read = infile.read\n\n while True:\n sep = read(1)\n\n if sep == record_type:\n if self.raw:\n items = [(field.name, read(field.length)) \\\n for field in self.fields]\n else:\n items = [(field.name,\n parse(field, read(field.length))) \\\n for field in self.fields]\n\n yield self.recfactory(items)\n\n elif sep in (b'\\x1a', b''):\n # End of records.\n break\n else:\n skip_record(infile)", "metadata": "root.DBF._iter_records", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 278 }, { "content": " def __iter__(self):\n if self.loaded:\n return list.__iter__(self._records)\n else:\n return self._iter_records()", "metadata": "root.DBF.__iter__", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 313 }, { "content": " def __len__(self):\n return len(self.records)", "metadata": "root.DBF.__len__", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 319 }, { "content": " def __repr__(self):\n if self.loaded:\n status = 'loaded'\n else:\n status = 'unloaded'\n return '<{} DBF table {!r}>'.format(status, self.filename)", "metadata": "root.DBF.__repr__", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 322 }, { "content": " def __enter__(self):\n return self", "metadata": "root.DBF.__enter__", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 329 }, { "content": " def __exit__(self, type, value, traceback):\n self.unload()\n return False", "metadata": "root.DBF.__exit__", "header": "['class', 'DBF', '(', 'object', ')', ':', '___EOS___']", "index": 332 } ]
[ { "span": "import sys", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Class", " ", "to", " ", "read", " ", "DB", "F", " ", "files", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "ifi", "les_", "import_", "ifi", "nd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "struct", "\\u", "parser_", "import_", "Stru", "ct", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "field", "\\u", "parser_", "import_", "Field", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "memo_", "import_", "find", "\\u", "memo", "file_", ",_", "open", "\\u", "memo", "file_", ",_", "Fake", "Memo", "File_", ",_", "Bin", "ary", "Memo", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "code", "pages_", "import_", "guess", "\\u", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "db", "versions_", "import_", "get", "\\u", "db", "version", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "exceptions_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DB", "FH", "eader", "_", "=_", "Stru", "ct", "Parser_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DB", "FH", "eader", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "BBBB", "LH", "HH", "BB", "LL", "LB", "BH", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "db", "version", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "year", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "month", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "day", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "numr", "ecor", "ds", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "len", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "record", "len", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reserve", "d1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "incomplete", "\\u", "transaction", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "encrypt", "ion", "\\u", "flag", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "free", "\\u", "record", "\\u", "thread", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reserve", "d2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reserve", "d3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "md", "x", "\\u", "flag", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "\\u", "driver", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reserve", "d4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DB", "FF", "ield_", "=_", "Stru", "ct", "Parser_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DB", "FF", "iel", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "11", "sc", "LB", "BH", "BBBB", "7", "s", "B", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "length", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "decima", "l\\u", "count", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reserve", "d1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "workar", "ea", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reserve", "d2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reserve", "d3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "set\\u", "fields", "\\u", "flag", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reserve", "d4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "index", "\\u", "field", "\\u", "flag", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "expand", "\\u", "year_", "(_", "year_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "2", "-", "digit", " ", "year", " ", "to", " ", "4", "-", "digit", " ", "year", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "year_", "<_", "80_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "2000_", "+_", "year_", "\\u\\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_", "1900", "_", "+_", "year_", "\\u\\u\\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_", "Record", "Iterator_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Record", "Iterator_", "(_", "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_", ",_", "table_", ",_", "record", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "record", "\\u", "type_", "=_", "record", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "table_", "=_", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Record", "Iterator_", "(_", "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_", "self_", "._", "\\u", "table_", "._", "\\u", "iter", "\\u", "records_", "(_", "self_", "._", "\\u", "record", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Record", "Iterator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "table_", "._", "\\u", "count", "\\u", "records_", "(_", "self_", "._", "\\u", "record", "\\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_", "DB", "F_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "DB", "F", " ", "table", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "filename_", ",_", "encoding_", "=_", "None_", ",_", "ignore", "case_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lower", "names_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "class_", "=_", "Field", "Parser_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "factory_", "=_", "collections_", "._", "Order", "ed", "Dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "load_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "raw_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "missi", "ng", "\\u", "memo", "file_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "encoding_", "=_", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ignore", "case_", "=_", "ignore", "case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lower", "names_", "=_", "lower", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parser", "class_", "=_", "parser", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "raw_", "=_", "raw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ignore", "\\u", "missi", "ng", "\\u", "memo", "file_", "=_", "ignore", "\\u", "missi", "ng", "\\u", "memo", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "rec", "factory_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rec", "factory_", "=_", "lambda_", "items_", ":_", "items_", "\\u\\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_", "._", "rec", "factory_", "=_", "rec", "factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Name", " ", "part", " ", "bef", "ore", " ", ".", "dbf", " ", "is", " ", "the", " ", "table", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "name_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "self_", "._", "name_", ")_", "[_", "0_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "records_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "deleted_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ignore", "case_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filename_", "=_", "ifi", "nd_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "DB", "FN", "ot", "Found_", "(_", "'", "coul", "d", " ", "not", " ", "find", " ", "file", " ", "{", "!", "r", "}'_", "._", "format_", "(_", "filename_", ")_", ")_", "\\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_", "._", "filename_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fille", "d", " ", "in", " ", "by", " ", "self", ".\\u", "read", "\\u", "header", "s", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "memo", "filename_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "header_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "=_", "[_", "]_", "#", " ", "namedtupl", "es_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "field", "\\u", "names_", "=_", "[_", "]_", "#", " ", "strings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "self_", "._", "filename_", ",_", "mode_", "=_", "'", "rb", "'_", ")_", "as_", "infile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "read", "\\u", "header_", "(_", "infile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "field", "\\u", "headers_", "(_", "infile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "headers_", "(_", ")_", "\\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_", "._", "date_", "=_", "datetime_", "._", "date_", "(_", "expand", "\\u", "year_", "(_", "self_", "._", "header_", "._", "year_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "header_", "._", "month_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "header_", "._", "day_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Inva", "lid", " ", "date", " ", "or", " ", "'\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "date_", "=_", "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_", "self_", "._", "memo", "filename_", "=_", "self_", "._", "\\u", "get", "\\u", "memo", "filename_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "load_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "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_", "def_", "db", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "get", "\\u", "db", "version", "\\u", "string_", "(_", "self_", "._", "header_", "._", "db", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "memo", "filename_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Do", "es", " ", "the", " ", "table", " ", "have", " ", "a", " ", "memo", " ", "field", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "types_", "=_", "[_", "field_", "._", "type_", "for_", "field_", "in_", "self_", "._", "fields_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "set_", "(_", "field", "\\u", "types_", ")_", "&_", "set_", "(_", "'", "MG", "PB", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "memo", " ", "fields", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "find", "\\u", "memo", "file_", "(_", "self_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "path_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "ignore", "\\u", "missi", "ng", "\\u", "memo", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Missing", "Memo", "File_", "(_", "'", "missi", "ng", " ", "memo", " ", "file", " ", "for", " ", "{}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filename_", ")_", ")_", "\\u\\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_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "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_", "def_", "loaded_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "``", "Tru", "e", "``", " ", "if", " ", "record", "s", " ", "are", " ", "load", "ed", " ", "int", "o", " ", "memory", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "records_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Load", " ", "record", "s", " ", "int", "o", " ", "memory", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "load", "s", " ", "bot", "h", " ", "record", "s", " ", "and", " ", "delete", "d", " ", "record", "s", ".", " ", "The", " ", "``", "record", "s", "``", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "``", "delete", "d", "``", " ", "attribute", "s", " ", "will", " ", "now", " ", "be", " ", "lists", " ", "of", " ", "record", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "loaded_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "records_", "=_", "list_", "(_", "self_", "._", "\\u", "iter", "\\u", "records_", "(_", "b", "'", " ", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "deleted_", "=_", "list_", "(_", "self_", "._", "\\u", "iter", "\\u", "records_", "(_", "b", "'*'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "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_", "unload", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Unlo", "ad", " ", "record", "s", " ", "from", " ", "memory", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "record", "s", " ", "and", " ", "delete", "d", " ", "attribute", "s", " ", "will", " ", "now", " ", "be", " ", "instance", "s", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "``", "Record", "Iterat", "or", "``", ",", " ", "whi", "ch", " ", "stream", "s", " ", "record", "s", " ", "from", " ", "disk", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "records_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "deleted_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "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_", "def_", "records_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Record", "s", " ", "(", "not", " ", "include", "d", " ", "delete", "d", " ", "ones", ").", " ", "Whe", "n", " ", "load", "ed", " ", "a", " ", "list", " ", "of", " ", "record", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "whe", "n", " ", "not", " ", "load", "ed", " ", "a", " ", "new", " ", "``", "Record", "Iterat", "or", "``", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "loaded_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "records_", "\\u\\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_", "Record", "Iterator_", "(_", "self_", ",_", "b", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "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_", "def_", "deleted_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", "d", " ", "record", "s", ".", " ", "Whe", "n", " ", "load", "ed", " ", "a", " ", "list", " ", "of", " ", "record", "s", ",", " ", "whe", "n", " ", "not", " ", "load", "ed", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "new", " ", "``", "Record", "Iterat", "or", "``", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "loaded_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "deleted_", "\\u\\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_", "Record", "Iterator_", "(_", "self_", ",_", "b", "'*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "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", "read", "\\u", "header_", "(_", "self_", ",_", "infile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Todo", ":", " ", "more", " ", "checks", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "header_", "=_", "DB", "FH", "eader", "_", "._", "read_", "(_", "infile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "encoding_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "encoding_", "=_", "guess", "\\u", "encoding_", "(_", "self_", "._", "header_", "._", "language", "\\u", "driver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Look", "up", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "encoding_", "=_", "'", "ascii", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "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", "read", "\\u", "field", "\\u", "headers_", "(_", "self_", ",_", "infile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sep_", "=_", "infile_", "._", "read_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sep_", "in_", "(_", "b", "'\\\\", "r", "'_", ",_", "b", "'\\\\", "n", "'_", ",_", "b", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "End", " ", "of", " ", "field", " ", "headers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "=_", "DB", "FF", "ield_", "._", "unpack_", "(_", "sep_", "+_", "infile_", "._", "read_", "(_", "DB", "FF", "ield_", "._", "size_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "._", "type_", "=_", "chr_", "(_", "ord_", "(_", "field_", "._", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Field", " ", "name", " ", "is", " ", "b", "'\\\\", "0", "'", " ", "terminate", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "field_", "._", "name_", "=_", "field_", "._", "name_", "._", "split_", "(_", "b", "'\\\\", "0", "'_", ")_", "[_", "0_", "]_", "._", "decode_", "(_", "self_", "._", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "lower", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "._", "name_", "=_", "field_", "._", "name_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "field", "\\u", "names_", "._", "append_", "(_", "field_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "._", "append_", "(_", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "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", "open", "\\u", "memo", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "memo", "filename_", "and_", "not_", "self_", "._", "raw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "open", "\\u", "memo", "file_", "(_", "self_", "._", "memo", "filename_", ",_", "self_", "._", "header_", "._", "db", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Fake", "Memo", "File_", "(_", "self_", "._", "memo", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "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", "check", "\\u", "headers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "parser_", "=_", "self_", "._", "parser", "class_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Check", " ", "header", "s", " ", "for", " ", "possib", "le", " ", "format", " ", "error", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "self_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "field_", "._", "type_", "==_", "'", "I", "'_", "and_", "field_", "._", "length_", "!=_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "'", "Field", " ", "type", " ", "I", " ", "must", " ", "have", " ", "length", " ", "4", " ", "(", "was", " ", "{})", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "message_", "._", "format_", "(_", "field_", "._", "length_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "field_", "._", "type_", "==_", "'", "L", "'_", "and_", "field_", "._", "length_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "'", "Field", " ", "type", " ", "L", " ", "must", " ", "have", " ", "length", " ", "1", " ", "(", "was", " ", "{})", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "message_", "._", "format_", "(_", "field_", "._", "length_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "field", "\\u", "parser_", "._", "field", "\\u", "type", "\\u", "supported_", "(_", "field_", "._", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Todo", ":", " ", "return", " ", "as", " ", "byte", " ", "string", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Un", "know", "n", " ", "field", " ", "type", ":", " ", "{", "!", "r", "}'_", "._", "format_", "(_", "field_", "._", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "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", "skip", "\\u", "record_", "(_", "self_", ",_", "infile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-1", " ", "for", " ", "the", " ", "record", " ", "separator", " ", "whi", "ch", " ", "was", " ", "alr", "ead", "y", " ", "read", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "infile_", "._", "seek_", "(_", "self_", "._", "header_", "._", "record", "len_", "-_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "count", "\\u", "records_", "(_", "self_", ",_", "record", "\\u", "type_", "=_", "b", "'", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "self_", "._", "filename_", ",_", "'", "rb", "'_", ")_", "as_", "infile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ski", "p", " ", "to", " ", "first", " ", "record", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "infile_", "._", "seek_", "(_", "self_", "._", "header_", "._", "header", "len_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sep_", "=_", "infile_", "._", "read_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sep_", "==_", "record", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "skip", "\\u", "record_", "(_", "infile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sep_", "in_", "(_", "b", "'\\\\", "x1", "a", "'_", ",_", "b", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "End", " ", "of", " ", "record", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "skip", "\\u", "record_", "(_", "infile_", ")_", "\\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_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "iter", "\\u", "records_", "(_", "self_", ",_", "record", "\\u", "type_", "=_", "b", "'", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "self_", "._", "filename_", ",_", "'", "rb", "'_", ")_", "as_", "infile_", ",_", "self_", "._", "\\u", "open", "\\u", "memo", "file_", "(_", ")_", "as_", "memo", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ski", "p", " ", "to", " ", "first", " ", "record", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "infile_", "._", "seek_", "(_", "self_", "._", "header_", "._", "header", "len_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "raw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "parser_", "=_", "self_", "._", "parser", "class_", "(_", "self_", ",_", "memo", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parse_", "=_", "field", "\\u", "parser_", "._", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Short", "cuts", " ", "for", " ", "speed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "skip", "\\u", "record_", "=_", "self_", "._", "\\u", "skip", "\\u", "record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read_", "=_", "infile_", "._", "read_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sep_", "=_", "read_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sep_", "==_", "record", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "raw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "items_", "=_", "[_", "(_", "field_", "._", "name_", ",_", "read_", "(_", "field_", "._", "length_", ")_", ")_", "for_", "field_", "in_", "self_", "._", "fields_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "items_", "=_", "[_", "(_", "field_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parse_", "(_", "field_", ",_", "read_", "(_", "field_", "._", "length_", ")_", ")_", ")_", "for_", "field_", "in_", "self_", "._", "fields_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "self_", "._", "rec", "factory_", "(_", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sep_", "in_", "(_", "b", "'\\\\", "x1", "a", "'_", ",_", "b", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "End", " ", "of", " ", "record", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "skip", "\\u", "record_", "(_", "infile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "loaded_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "._", "\\u\\u", "iter\\u\\u_", "(_", "self_", "._", "\\u", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "iter", "\\u", "records_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "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", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "self_", "._", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "loaded_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "'", "load", "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 ", " _", "status_", "=_", "'", "unload", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'<", "{}", " ", "DB", "F", " ", "table", " ", "{", "!", "r", "}>", "'_", "._", "format_", "(_", "status_", ",_", "self_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "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 ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "F_", "(_", "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_", ",_", "type_", ",_", "value_", ",_", "traceback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "unload", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Comparison of constants
openstack/gertty/gertty/search/parser.py
[ { "content": "def SearchParser():\n precedence = ( # NOQA\n ('left', 'NOT', 'NEG'),\n )\n\n def p_terms(p):\n '''expression : list_expr\n | paren_expr\n | boolean_expr\n | negative_expr\n | term'''\n p[0] = p[1]\n\n def p_list_expr(p):\n '''list_expr : expression expression'''\n p[0] = and_(p[1], p[2])\n\n def p_paren_expr(p):\n '''paren_expr : LPAREN expression RPAREN'''\n p[0] = p[2]\n\n def p_boolean_expr(p):\n '''boolean_expr : expression AND expression\n | expression OR expression'''\n if p[2].lower() == 'and':\n p[0] = and_(p[1], p[3])\n elif p[2].lower() == 'or':\n p[0] = or_(p[1], p[3])\n else:\n raise gertty.search.SearchSyntaxError(\"Boolean %s not recognized\" % p[2])\n\n def p_negative_expr(p):\n '''negative_expr : NOT expression\n | NEG expression'''\n p[0] = not_(p[2])\n\n def p_term(p):\n '''term : age_term\n | recentlyseen_term\n | change_term\n | owner_term\n | reviewer_term\n | commit_term\n | project_term\n | project_key_term\n | branch_term\n | topic_term\n | ref_term\n | label_term\n | message_term\n | comment_term\n | has_term\n | is_term\n | status_term\n | file_term\n | limit_term\n | op_term'''\n p[0] = p[1]\n\n def p_string(p):\n '''string : SSTRING\n | DSTRING\n | USTRING'''\n p[0] = p[1]\n\n def p_age_term(p):\n '''age_term : OP_AGE NUMBER string'''\n now = datetime.datetime.utcnow()\n delta = p[2]\n unit = p[3]\n delta = age_to_delta(delta, unit)\n p[0] = gertty.db.change_table.c.updated < (now-datetime.timedelta(seconds=delta))\n\n def p_recentlyseen_term(p):\n '''recentlyseen_term : OP_RECENTLYSEEN NUMBER string'''\n # A gertty extension\n now = datetime.datetime.utcnow()\n delta = p[2]\n unit = p[3]\n delta = age_to_delta(delta, unit)\n s = select([func.datetime(func.max(gertty.db.change_table.c.last_seen), '-%s seconds' % delta)],\n correlate=False)\n p[0] = gertty.db.change_table.c.last_seen >= s\n\n def p_change_term(p):\n '''change_term : OP_CHANGE CHANGE_ID\n | OP_CHANGE NUMBER'''\n if type(p[2]) == int:\n p[0] = gertty.db.change_table.c.number == p[2]\n else:\n p[0] = gertty.db.change_table.c.change_id == p[2]\n\n def p_owner_term(p):\n '''owner_term : OP_OWNER string'''\n if p[2] == 'self':\n username = p.parser.username\n p[0] = gertty.db.account_table.c.username == username\n else:\n p[0] = or_(gertty.db.account_table.c.username == p[2],\n gertty.db.account_table.c.email == p[2],\n gertty.db.account_table.c.name == p[2])\n\n def p_reviewer_term(p):\n '''reviewer_term : OP_REVIEWER string\n | OP_REVIEWER NUMBER'''\n filters = []\n filters.append(gertty.db.approval_table.c.change_key == gertty.db.change_table.c.key)\n filters.append(gertty.db.approval_table.c.account_key == gertty.db.account_table.c.key)\n try:\n number = int(p[2])\n except:\n number = None\n if number is not None:\n filters.append(gertty.db.account_table.c.id == number)\n elif p[2] == 'self':\n username = p.parser.username\n filters.append(gertty.db.account_table.c.username == username)\n else:\n filters.append(or_(gertty.db.account_table.c.username == p[2],\n gertty.db.account_table.c.email == p[2],\n gertty.db.account_table.c.name == p[2]))\n s = select([gertty.db.change_table.c.key], correlate=False).where(and_(*filters))\n p[0] = gertty.db.change_table.c.key.in_(s)\n\n def p_commit_term(p):\n '''commit_term : OP_COMMIT string'''\n filters = []\n filters.append(gertty.db.revision_table.c.change_key == gertty.db.change_table.c.key)\n filters.append(gertty.db.revision_table.c.commit == p[2])\n s = select([gertty.db.change_table.c.key], correlate=False).where(and_(*filters))\n p[0] = gertty.db.change_table.c.key.in_(s)\n\n def p_project_term(p):\n '''project_term : OP_PROJECT string'''\n if p[2].startswith('^'):\n p[0] = func.matches(p[2], gertty.db.project_table.c.name)\n else:\n p[0] = gertty.db.project_table.c.name == p[2]\n\n def p_project_key_term(p):\n '''project_key_term : OP_PROJECT_KEY NUMBER'''\n p[0] = gertty.db.change_table.c.project_key == p[2]\n\n def p_branch_term(p):\n '''branch_term : OP_BRANCH string'''\n if p[2].startswith('^'):\n p[0] = func.matches(p[2], gertty.db.change_table.c.branch)\n else:\n p[0] = gertty.db.change_table.c.branch == p[2]\n\n def p_topic_term(p):\n '''topic_term : OP_TOPIC string'''\n if p[2].startswith('^'):\n p[0] = func.matches(p[2], gertty.db.change_table.c.topic)\n else:\n p[0] = gertty.db.change_table.c.topic == p[2]\n\n def p_ref_term(p):\n '''ref_term : OP_REF string'''\n if p[2].startswith('^'):\n p[0] = func.matches(p[2], 'refs/heads/'+gertty.db.change_table.c.branch)\n else:\n p[0] = gertty.db.change_table.c.branch == p[2][len('refs/heads/'):]\n\n label_re = re.compile(r'(?P<label>[a-zA-Z0-9_-]+([a-zA-Z]|((?<![-+])[0-9])))'\n r'(?P<operator>[<>]?=?)(?P<value>[-+]?[0-9]+)'\n r'($|,(user=)?(?P<user>\\S+))')\n\n def p_label_term(p):\n '''label_term : OP_LABEL string'''\n args = label_re.match(p[2])\n label = args.group('label')\n op = args.group('operator') or '='\n value = int(args.group('value'))\n user = args.group('user')\n\n filters = []\n filters.append(gertty.db.approval_table.c.change_key == gertty.db.change_table.c.key)\n filters.append(gertty.db.approval_table.c.category == label)\n if op == '=':\n filters.append(gertty.db.approval_table.c.value == value)\n elif op == '>=':\n filters.append(gertty.db.approval_table.c.value >= value)\n elif op == '<=':\n filters.append(gertty.db.approval_table.c.value <= value)\n if user is not None:\n filters.append(gertty.db.approval_table.c.account_key == gertty.db.account_table.c.key)\n if user == 'self':\n filters.append(gertty.db.account_table.c.username == p.parser.username)\n else:\n filters.append(\n or_(gertty.db.account_table.c.username == user,\n gertty.db.account_table.c.email == user,\n gertty.db.account_table.c.name == user))\n s = select([gertty.db.change_table.c.key], correlate=False).where(and_(*filters))\n p[0] = gertty.db.change_table.c.key.in_(s)\n\n def p_message_term(p):\n '''message_term : OP_MESSAGE string'''\n filters = []\n filters.append(gertty.db.revision_table.c.change_key == gertty.db.change_table.c.key)\n filters.append(gertty.db.revision_table.c.message.like('%%%s%%' % p[2]))\n s = select([gertty.db.change_table.c.key], correlate=False).where(and_(*filters))\n p[0] = gertty.db.change_table.c.key.in_(s)\n\n def p_comment_term(p):\n '''comment_term : OP_COMMENT string'''\n filters = []\n filters.append(gertty.db.revision_table.c.change_key == gertty.db.change_table.c.key)\n filters.append(gertty.db.revision_table.c.message == p[2])\n revision_select = select([gertty.db.change_table.c.key], correlate=False).where(and_(*filters))\n filters = []\n filters.append(gertty.db.revision_table.c.change_key == gertty.db.change_table.c.key)\n filters.append(gertty.db.comment_table.c.revision_key == gertty.db.revision_table.c.key)\n filters.append(gertty.db.comment_table.c.message == p[2])\n comment_select = select([gertty.db.change_table.c.key], correlate=False).where(and_(*filters))\n p[0] = or_(gertty.db.change_table.c.key.in_(comment_select),\n gertty.db.change_table.c.key.in_(revision_select))\n\n def p_has_term(p):\n '''has_term : OP_HAS string'''\n #TODO: implement star\n if p[2] == 'draft':\n filters = []\n filters.append(gertty.db.revision_table.c.change_key == gertty.db.change_table.c.key)\n filters.append(gertty.db.message_table.c.revision_key == gertty.db.revision_table.c.key)\n filters.append(gertty.db.message_table.c.draft == True)\n s = select([gertty.db.change_table.c.key], correlate=False).where(and_(*filters))\n p[0] = gertty.db.change_table.c.key.in_(s)\n else:\n raise gertty.search.SearchSyntaxError('Syntax error: has:%s is not supported' % p[2])\n\n def p_is_term(p):\n '''is_term : OP_IS string'''\n #TODO: implement draft\n username = p.parser.username\n if p[2] == 'reviewed':\n filters = []\n filters.append(gertty.db.approval_table.c.change_key == gertty.db.change_table.c.key)\n filters.append(gertty.db.approval_table.c.value != 0)\n s = select([gertty.db.change_table.c.key], correlate=False).where(and_(*filters))\n p[0] = gertty.db.change_table.c.key.in_(s)\n elif p[2] == 'open':\n p[0] = gertty.db.change_table.c.status.notin_(['MERGED', 'ABANDONED'])\n elif p[2] == 'closed':\n p[0] = gertty.db.change_table.c.status.in_(['MERGED', 'ABANDONED'])\n elif p[2] == 'submitted':\n p[0] = gertty.db.change_table.c.status == 'SUBMITTED'\n elif p[2] == 'merged':\n p[0] = gertty.db.change_table.c.status == 'MERGED'\n elif p[2] == 'abandoned':\n p[0] = gertty.db.change_table.c.status == 'ABANDONED'\n elif p[2] == 'owner':\n p[0] = gertty.db.account_table.c.username == username\n elif p[2] == 'starred':\n p[0] = gertty.db.change_table.c.starred == True\n elif p[2] == 'held':\n # A gertty extension\n p[0] = gertty.db.change_table.c.held == True\n elif p[2] == 'reviewer':\n filters = []\n filters.append(gertty.db.approval_table.c.change_key == gertty.db.change_table.c.key)\n filters.append(gertty.db.approval_table.c.account_key == gertty.db.account_table.c.key)\n filters.append(gertty.db.account_table.c.username == username)\n s = select([gertty.db.change_table.c.key], correlate=False).where(and_(*filters))\n p[0] = gertty.db.change_table.c.key.in_(s)\n elif p[2] == 'watched':\n p[0] = gertty.db.project_table.c.subscribed == True\n else:\n raise gertty.search.SearchSyntaxError('Syntax error: is:%s is not supported' % p[2])\n\n def p_file_term(p):\n '''file_term : OP_FILE string'''\n if p[2].startswith('^'):\n p[0] = and_(or_(func.matches(p[2], gertty.db.file_table.c.path),\n func.matches(p[2], gertty.db.file_table.c.old_path)),\n gertty.db.file_table.c.status is not None)\n else:\n p[0] = and_(or_(gertty.db.file_table.c.path == p[2],\n gertty.db.file_table.c.old_path == p[2]),\n gertty.db.file_table.c.status is not None)\n\n def p_status_term(p):\n '''status_term : OP_STATUS string'''\n if p[2] == 'open':\n p[0] = gertty.db.change_table.c.status.notin_(['MERGED', 'ABANDONED'])\n elif p[2] == 'closed':\n p[0] = gertty.db.change_table.c.status.in_(['MERGED', 'ABANDONED'])\n else:\n p[0] = gertty.db.change_table.c.status == p[2].upper()\n\n def p_limit_term(p):\n '''limit_term : OP_LIMIT NUMBER'''\n # TODO: Implement this. The sqlalchemy limit call needs to be\n # applied to the query operation and so can not be returned as\n # part of the production here. The information would need to\n # be returned out-of-band. In the mean time, since limits are\n # not as important in gertty, make this a no-op for now so\n # that it does not produce a syntax error.\n p[0] = (True == True)\n\n def p_op_term(p):\n 'op_term : OP'\n raise SyntaxError()\n\n def p_error(p):\n if p:\n raise gertty.search.SearchSyntaxError('Syntax error at \"%s\" in search string \"%s\" (col %s)' % (\n p.lexer.lexdata[p.lexpos:], p.lexer.lexdata, p.lexpos))\n else:\n raise gertty.search.SearchSyntaxError('Syntax error: EOF in search string')\n\n return yacc.yacc(debug=0, write_tables=0)", "metadata": "root.SearchParser", "header": "['module', '___EOS___']", "index": 41 } ]
[ { "span": "True == True)", "start_line": 340, "start_column": 16, "end_line": 340, "end_column": 28 } ]
[]
1
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Sear", "ch", "Parser_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "preceden", "ce_", "=_", "(_", "#", " ", "NO", "QA", "_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "left", "'_", ",_", "'", "NOT", "'_", ",_", "'", "NEG", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "p", "\\u", "terms_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "express", "ion", " ", ":", " ", "list", "\\u", "expr", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "paren", "\\u", "expr", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "boolean", "\\u", "expr", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "negati", "ve", "\\u", "expr", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "term", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "p_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "list", "\\u", "expr_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "list", "\\u", "expr", " ", ":", " ", "express", "ion", " ", "express", "ion", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "and\\u_", "(_", "p_", "[_", "1_", "]_", ",_", "p_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "paren", "\\u", "expr_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "paren", "\\u", "expr", " ", ":", " ", "LPAR", "EN", " ", "express", "ion", " ", "RPA", "REN", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "p_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "boolean", "\\u", "expr_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "boolean", "\\u", "expr", " ", ":", " ", "express", "ion", " ", "AND", " ", "express", "ion", "\\", "10", ";", " ", " ", "|", " ", "express", "ion", " ", "OR", " ", "express", "ion", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "2_", "]_", "._", "lower_", "(_", ")_", "==_", "'", "and", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "and\\u_", "(_", "p_", "[_", "1_", "]_", ",_", "p_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "[_", "2_", "]_", "._", "lower_", "(_", ")_", "==_", "'", "or", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "or\\u_", "(_", "p_", "[_", "1_", "]_", ",_", "p_", "[_", "3_", "]_", ")_", "\\u\\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_", "ger", "tty_", "._", "search_", "._", "Sear", "ch", "Syntax", "Error_", "(_", "\"", "Boo", "lean", " ", "%", "s", " ", "not", " ", "recognize", "d", "\"_", "%_", "p_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "negati", "ve", "\\u", "expr_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "negati", "ve", "\\u", "expr", " ", ":", " ", "NOT", " ", "express", "ion", "\\", "10", ";", " ", " ", " ", "|", " ", "NEG", " ", "express", "ion", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "not", "\\u_", "(_", "p_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "term", " ", ":", " ", "age", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "recent", "lys", "een", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "change", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "owner", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "reviewer", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "commit", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "project", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "project", "\\u", "key", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "branch", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "topic", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "ref", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "label", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "message", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "comment", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "has", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "is", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "status", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "file", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "limit", "\\u", "term", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "op", "\\u", "term", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "p_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "string_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "string", " ", ":", " ", "SS", "TRING", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "|", " ", "DST", "RING", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "|", " ", "UST", "RING", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "p_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "age", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "age", "\\u", "term", " ", ":", " ", "OP", "\\u", "AGE", " ", "NUMB", "ER", " ", "string", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delta_", "=_", "p_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unit_", "=_", "p_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delta_", "=_", "age", "\\u", "to", "\\u", "delta_", "(_", "delta_", ",_", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "updated_", "<_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "delta_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "recent", "lys", "een", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "recent", "lys", "een", "\\u", "term", " ", ":", " ", "OP", "\\u", "REC", "ENT", "LYS", "EE", "N", " ", "NUMB", "ER", " ", "string", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "ger", "tt", "y", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "now_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delta_", "=_", "p_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unit_", "=_", "p_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delta_", "=_", "age", "\\u", "to", "\\u", "delta_", "(_", "delta_", ",_", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "select_", "(_", "[_", "func_", "._", "datetime_", "(_", "func_", "._", "max_", "(_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "last", "\\u", "seen_", ")_", ",_", "'-", "%", "s", " ", "second", "s", "'_", "%_", "delta_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "correlate", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "last", "\\u", "seen_", ">=_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "change", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "change", "\\u", "term", " ", ":", " ", "OP", "\\u", "CHANGE", " ", "CHANGE", "\\u", "ID", "\\", "10", ";", " ", " ", " ", " ", " ", "|", " ", "OP", "\\u", "CHANGE", " ", "NUMB", "ER", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "p_", "[_", "2_", "]_", ")_", "==_", "int_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "number_", "==_", "p_", "[_", "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 ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "change", "\\u", "id_", "==_", "p_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "owner", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "owner", "\\u", "term", " ", ":", " ", "OP", "\\u", "OWNER", " ", "string", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "2_", "]_", "==_", "'", "self", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "p_", "._", "parser_", "._", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "username_", "==_", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "or\\u_", "(_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "username_", "==_", "p_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "email_", "==_", "p_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "name_", "==_", "p_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "reviewer", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "reviewer", "\\u", "term", " ", ":", " ", "OP", "\\u", "REVI", "EW", "ER", " ", "string", "\\", "10", ";", " ", " ", " ", "|", " ", "OP", "\\u", "REVI", "EW", "ER", " ", "NUMB", "ER", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "approval", "\\u", "table_", "._", "c_", "._", "change", "\\u", "key_", "==_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "approval", "\\u", "table_", "._", "c_", "._", "account", "\\u", "key_", "==_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "number_", "=_", "int_", "(_", "p_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "number_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "number_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "id_", "==_", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "[_", "2_", "]_", "==_", "'", "self", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "p_", "._", "parser_", "._", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "username_", "==_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "._", "append_", "(_", "or\\u_", "(_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "username_", "==_", "p_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "email_", "==_", "p_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "name_", "==_", "p_", "[_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "select_", "(_", "[_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "]_", ",_", "correlate", "_", "=_", "False_", ")_", "._", "where_", "(_", "and\\u_", "(_", "*_", "filters_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "._", "in\\u_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "commit", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "commit", "\\u", "term", " ", ":", " ", "OP", "\\u", "COMMIT", " ", "string", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "revis", "ion", "\\u", "table_", "._", "c_", "._", "change", "\\u", "key_", "==_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "revis", "ion", "\\u", "table_", "._", "c_", "._", "commit_", "==_", "p_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "select_", "(_", "[_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "]_", ",_", "correlate", "_", "=_", "False_", ")_", "._", "where_", "(_", "and\\u_", "(_", "*_", "filters_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "._", "in\\u_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "project", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "project", "\\u", "term", " ", ":", " ", "OP", "\\u", "PROJECT", " ", "string", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "2_", "]_", "._", "startswith_", "(_", "'", "^", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "func_", "._", "matches_", "(_", "p_", "[_", "2_", "]_", ",_", "ger", "tty_", "._", "db_", "._", "project", "\\u", "table_", "._", "c_", "._", "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 ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "project", "\\u", "table_", "._", "c_", "._", "name_", "==_", "p_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "project", "\\u", "key", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "project", "\\u", "key", "\\u", "term", " ", ":", " ", "OP", "\\u", "PROJECT", "\\u", "KEY", " ", "NUMB", "ER", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "project", "\\u", "key_", "==_", "p_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "branch", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "branch", "\\u", "term", " ", ":", " ", "OP", "\\u", "BRANCH", " ", "string", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "2_", "]_", "._", "startswith_", "(_", "'", "^", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "func_", "._", "matches_", "(_", "p_", "[_", "2_", "]_", ",_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "branch_", "==_", "p_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "topic", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "topic", "\\u", "term", " ", ":", " ", "OP", "\\u", "TOPIC", " ", "string", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "2_", "]_", "._", "startswith_", "(_", "'", "^", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "func_", "._", "matches_", "(_", "p_", "[_", "2_", "]_", ",_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "topic_", "==_", "p_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "ref", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "ref", "\\u", "term", " ", ":", " ", "OP", "\\u", "REF", " ", "string", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "2_", "]_", "._", "startswith_", "(_", "'", "^", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "func_", "._", "matches_", "(_", "p_", "[_", "2_", "]_", ",_", "'", "refs", "/", "head", "s", "/'_", "+_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "branch_", "==_", "p_", "[_", "2_", "]_", "[_", "len_", "(_", "'", "refs", "/", "head", "s", "/'_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "label", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "r", "'(", "?", "P", "<", "label", ">[", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "\\u-]", "+([", "a", "-", "z", "A", "-", "Z", "]|", "((", "?<", "![", "-+", "])", "[", "0", "-", "9", "]))", ")'_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'(", "?", "P", "<", "opera", "tor", ">[", "<>", "]?", "=?", ")(?", "P", "<", "value", ">[-", "+]", "?", "[", "0", "-", "9", "]+)'_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'(", "$", "|", ",(", "user", "=", ")?(", "?", "P", "<", "user", ">\\\\", "S", "+))", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "p", "\\u", "label", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "label", "\\u", "term", " ", ":", " ", "OP", "\\u", "LAB", "EL", " ", "string", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "label", "\\u", "re_", "._", "match_", "(_", "p_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "args_", "._", "group_", "(_", "'", "label", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op_", "=_", "args_", "._", "group_", "(_", "'", "opera", "tor", "'_", ")_", "or_", "'='_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "int_", "(_", "args_", "._", "group_", "(_", "'", "value", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "args_", "._", "group_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filters_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "approval", "\\u", "table_", "._", "c_", "._", "change", "\\u", "key_", "==_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "approval", "\\u", "table_", "._", "c_", "._", "category_", "==_", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "op_", "==_", "'='_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "approval", "\\u", "table_", "._", "c_", "._", "value_", "==_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "'>='_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "approval", "\\u", "table_", "._", "c_", "._", "value_", ">=_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "==_", "'<='_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "approval", "\\u", "table_", "._", "c_", "._", "value_", "<=_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "user_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "approval", "\\u", "table_", "._", "c_", "._", "account", "\\u", "key_", "==_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", "==_", "'", "self", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "username_", "==_", "p_", "._", "parser_", "._", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "or\\u_", "(_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "username_", "==_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "email_", "==_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "name_", "==_", "user_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "select_", "(_", "[_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "]_", ",_", "correlate", "_", "=_", "False_", ")_", "._", "where_", "(_", "and\\u_", "(_", "*_", "filters_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "._", "in\\u_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "message", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "message", "\\u", "term", " ", ":", " ", "OP", "\\u", "MESSAGE", " ", "string", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "revis", "ion", "\\u", "table_", "._", "c_", "._", "change", "\\u", "key_", "==_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "revis", "ion", "\\u", "table_", "._", "c_", "._", "message_", "._", "like_", "(_", "'%%", "%", "s", "%%'", "_", "%_", "p_", "[_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "select_", "(_", "[_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "]_", ",_", "correlate", "_", "=_", "False_", ")_", "._", "where_", "(_", "and\\u_", "(_", "*_", "filters_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "._", "in\\u_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "comment", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "comment", "\\u", "term", " ", ":", " ", "OP", "\\u", "COMMENT", " ", "string", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "revis", "ion", "\\u", "table_", "._", "c_", "._", "change", "\\u", "key_", "==_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "revis", "ion", "\\u", "table_", "._", "c_", "._", "message_", "==_", "p_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "revis", "ion", "\\u", "select_", "=_", "select_", "(_", "[_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "]_", ",_", "correlate", "_", "=_", "False_", ")_", "._", "where_", "(_", "and\\u_", "(_", "*_", "filters_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "revis", "ion", "\\u", "table_", "._", "c_", "._", "change", "\\u", "key_", "==_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "comment", "\\u", "table_", "._", "c_", "._", "revis", "ion", "\\u", "key_", "==_", "ger", "tty_", "._", "db_", "._", "revis", "ion", "\\u", "table_", "._", "c_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "comment", "\\u", "table_", "._", "c_", "._", "message_", "==_", "p_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment", "\\u", "select_", "=_", "select_", "(_", "[_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "]_", ",_", "correlate", "_", "=_", "False_", ")_", "._", "where_", "(_", "and\\u_", "(_", "*_", "filters_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "or\\u_", "(_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "._", "in\\u_", "(_", "comment", "\\u", "select_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "._", "in\\u_", "(_", "revis", "ion", "\\u", "select_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "has", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "has", "\\u", "term", " ", ":", " ", "OP", "\\u", "HAS", " ", "string", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "implement", " ", "star_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "p_", "[_", "2_", "]_", "==_", "'", "draft", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "revis", "ion", "\\u", "table_", "._", "c_", "._", "change", "\\u", "key_", "==_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "message", "\\u", "table_", "._", "c_", "._", "revis", "ion", "\\u", "key_", "==_", "ger", "tty_", "._", "db_", "._", "revis", "ion", "\\u", "table_", "._", "c_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "message", "\\u", "table_", "._", "c_", "._", "draft_", "==_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "select_", "(_", "[_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "]_", ",_", "correlate", "_", "=_", "False_", ")_", "._", "where_", "(_", "and\\u_", "(_", "*_", "filters_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "._", "in\\u_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "ger", "tty_", "._", "search_", "._", "Sear", "ch", "Syntax", "Error_", "(_", "'", "Syntax", " ", "error", ":", " ", "has", ":", "%", "s", " ", "is", " ", "not", " ", "support", "ed", "'_", "%_", "p_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "is", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "is", "\\u", "term", " ", ":", " ", "OP", "\\u", "IS", " ", "string", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "implement", " ", "draft_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "p_", "._", "parser_", "._", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "2_", "]_", "==_", "'", "reviewe", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "approval", "\\u", "table_", "._", "c_", "._", "change", "\\u", "key_", "==_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "approval", "\\u", "table_", "._", "c_", "._", "value_", "!=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "select_", "(_", "[_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "]_", ",_", "correlate", "_", "=_", "False_", ")_", "._", "where_", "(_", "and\\u_", "(_", "*_", "filters_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "._", "in\\u_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "[_", "2_", "]_", "==_", "'", "open", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "status_", "._", "noti", "n", "\\u_", "(_", "[_", "'", "MERGE", "D", "'_", ",_", "'", "ABA", "ND", "ONE", "D", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "[_", "2_", "]_", "==_", "'", "close", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "status_", "._", "in\\u_", "(_", "[_", "'", "MERGE", "D", "'_", ",_", "'", "ABA", "ND", "ONE", "D", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "[_", "2_", "]_", "==_", "'", "submitted", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "status_", "==_", "'", "SUBMIT", "TED", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "[_", "2_", "]_", "==_", "'", "merge", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "status_", "==_", "'", "MERGE", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "[_", "2_", "]_", "==_", "'", "aband", "oned", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "status_", "==_", "'", "ABA", "ND", "ONE", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "[_", "2_", "]_", "==_", "'", "owner", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "username_", "==_", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "[_", "2_", "]_", "==_", "'", "starred", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "starred", "_", "==_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "[_", "2_", "]_", "==_", "'", "hel", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "ger", "tt", "y", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "hel", "d_", "==_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "[_", "2_", "]_", "==_", "'", "reviewer", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "approval", "\\u", "table_", "._", "c_", "._", "change", "\\u", "key_", "==_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "approval", "\\u", "table_", "._", "c_", "._", "account", "\\u", "key_", "==_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "ger", "tty_", "._", "db_", "._", "account", "\\u", "table_", "._", "c_", "._", "username_", "==_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "select_", "(_", "[_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "]_", ",_", "correlate", "_", "=_", "False_", ")_", "._", "where_", "(_", "and\\u_", "(_", "*_", "filters_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "key_", "._", "in\\u_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "[_", "2_", "]_", "==_", "'", "watched", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "project", "\\u", "table_", "._", "c_", "._", "subscribed", "_", "==_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "ger", "tty_", "._", "search_", "._", "Sear", "ch", "Syntax", "Error_", "(_", "'", "Syntax", " ", "error", ":", " ", "is", ":", "%", "s", " ", "is", " ", "not", " ", "support", "ed", "'_", "%_", "p_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "file", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "file", "\\u", "term", " ", ":", " ", "OP", "\\u", "FILE", " ", "string", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "2_", "]_", "._", "startswith_", "(_", "'", "^", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "and\\u_", "(_", "or\\u_", "(_", "func_", "._", "matches_", "(_", "p_", "[_", "2_", "]_", ",_", "ger", "tty_", "._", "db_", "._", "file", "\\u", "table_", "._", "c_", "._", "path_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "func_", "._", "matches_", "(_", "p_", "[_", "2_", "]_", ",_", "ger", "tty_", "._", "db_", "._", "file", "\\u", "table_", "._", "c_", "._", "old", "\\u", "path_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ger", "tty_", "._", "db_", "._", "file", "\\u", "table_", "._", "c_", "._", "status_", "is_", "not_", "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 ", " _", "p_", "[_", "0_", "]_", "=_", "and\\u_", "(_", "or\\u_", "(_", "ger", "tty_", "._", "db_", "._", "file", "\\u", "table_", "._", "c_", "._", "path_", "==_", "p_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ger", "tty_", "._", "db_", "._", "file", "\\u", "table_", "._", "c_", "._", "old", "\\u", "path_", "==_", "p_", "[_", "2_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ger", "tty_", "._", "db_", "._", "file", "\\u", "table_", "._", "c_", "._", "status_", "is_", "not_", "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_", "def_", "p", "\\u", "status", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "status", "\\u", "term", " ", ":", " ", "OP", "\\u", "STATUS", " ", "string", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "2_", "]_", "==_", "'", "open", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "status_", "._", "noti", "n", "\\u_", "(_", "[_", "'", "MERGE", "D", "'_", ",_", "'", "ABA", "ND", "ONE", "D", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "[_", "2_", "]_", "==_", "'", "close", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "status_", "._", "in\\u_", "(_", "[_", "'", "MERGE", "D", "'_", ",_", "'", "ABA", "ND", "ONE", "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 ", " _", "p_", "[_", "0_", "]_", "=_", "ger", "tty_", "._", "db_", "._", "change", "\\u", "table_", "._", "c_", "._", "status_", "==_", "p_", "[_", "2_", "]_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "limit", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "limit", "\\u", "term", " ", ":", " ", "OP", "\\u", "LIMIT", " ", "NUMB", "ER", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Impl", "ement", " ", "this", ".", " ", " ", "The", " ", "sqla", "lche", "my", " ", "limit", " ", "call", " ", "need", "s", " ", "to", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "applied", " ", "to", " ", "the", " ", "query", " ", "operati", "on", " ", "and", " ", "so", " ", "can", " ", "not", " ", "be", " ", "return", "ed", " ", "as_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "part", " ", "of", " ", "the", " ", "producti", "on", " ", "here", ".", " ", " ", "The", " ", "informati", "on", " ", "wou", "ld", " ", "need", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "return", "ed", " ", "out", "-", "of", "-", "band", ".", " ", " ", "In", " ", "the", " ", "mean", " ", "time", ",", " ", "sinc", "e", " ", "limit", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "as", " ", "importa", "nt", " ", "in", " ", "ger", "tt", "y", ",", " ", "make", " ", "this", " ", "a", " ", "no", "-", "op", " ", "for", " ", "now", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "it", " ", "doe", "s", " ", "not", " ", "produce", " ", "a", " ", "synta", "x", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "p_", "[_", "0_", "]_", "=_", "(_", "True_", "==_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "op", "\\u", "term_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'", "op", "\\u", "term", " ", ":", " ", "OP", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Syntax", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "\\u", "error_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "ger", "tty_", "._", "search_", "._", "Sear", "ch", "Syntax", "Error_", "(_", "'", "Syntax", " ", "error", " ", "at", " ", "\"%", "s", "\"", " ", "in", " ", "search", " ", "string", " ", "\"%", "s", "\"", " ", "(", "col", " ", "%", "s", ")'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "lexer_", "._", "lex", "data_", "[_", "p_", "._", "lex", "pos_", ":_", "]_", ",_", "p_", "._", "lexer_", "._", "lex", "data_", ",_", "p_", "._", "lex", "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_", "ger", "tty_", "._", "search_", "._", "Sear", "ch", "Syntax", "Error_", "(_", "'", "Syntax", " ", "error", ":", " ", "EO", "F", " ", "in", " ", "search", " ", "string", "'_", ")_", "\\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_", "yac", "c_", "._", "yac", "c_", "(_", "debug_", "=_", "0_", ",_", "write", "\\u", "tables_", "=_", "0_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
aws/aws-cli/awscli/testutils.py
[ { "content": "# Copyright 2012-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n# may not use this file except in compliance with the License. A copy of\n# the License is located at\n#\n# http://aws.amazon.com/apache2.0/\n#\n# or in the \"license\" file accompanying this file. This file is\n# distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n# ANY KIND, either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n\"\"\"Test utilities for the AWS CLI.\n\nThis module includes various classes/functions that help in writing\nCLI unit/integration tests. This module should not be imported by\nany module **except** for test code. This is included in the CLI\npackage so that code that is not part of the CLI can still take\nadvantage of all the testing utilities we provide.\n\n\"\"\"\nimport os\nimport sys\nimport copy\nimport shutil\nimport time\nimport json\nimport random\nimport logging\nimport tempfile\nimport platform\nimport contextlib\nimport string\nfrom pprint import pformat\nfrom subprocess import Popen, PIPE\n\nfrom awscli.compat import StringIO\n\n\ntry:\n import mock\nexcept ImportError as e:\n # In the off chance something imports this module\n # that's not suppose to, we should not stop the CLI\n # by raising an ImportError. Now if anything actually\n # *uses* this module that isn't suppose to, that's s\n # different story.\n mock = None\nfrom awscli.compat import six\nfrom botocore.hooks import HierarchicalEmitter\nfrom botocore.session import Session\nfrom botocore.exceptions import ClientError\nimport botocore.loaders\nfrom botocore.vendored import requests\n\nimport awscli.clidriver\nfrom awscli.plugin import load_plugins\nfrom awscli.clidriver import CLIDriver\nfrom awscli import EnvironmentVariables\n\n\n# The unittest module got a significant overhaul\n# in 2.7, so if we're in 2.6 we can use the backported\n# version unittest2.\nif sys.version_info[:2] == (2, 6):\n import unittest2 as unittest\nelse:\n import unittest\n\n\n# In python 3, order matters when calling assertEqual to\n# compare lists and dictionaries with lists. Therefore,\n# assertItemsEqual needs to be used but it is renamed to\n# assertCountEqual in python 3.\nif six.PY2:\n unittest.TestCase.assertCountEqual = unittest.TestCase.assertItemsEqual\n\n\n_LOADER = botocore.loaders.Loader()\nINTEG_LOG = logging.getLogger('awscli.tests.integration')\nAWS_CMD = None\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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 skip_if_windows(reason):\n \"\"\"Decorator to skip tests that should not be run on windows.\n\n Example usage:\n\n @skip_if_windows(\"Not valid\")\n def test_some_non_windows_stuff(self):\n self.assertEqual(...)\n\n \"\"\"\n def decorator(func):\n return unittest.skipIf(\n platform.system() not in ['Darwin', 'Linux'], reason)(func)\n return decorator", "metadata": "root.skip_if_windows", "header": "['module', '___EOS___']", "index": 83 }, { "content": "def create_clidriver():\n driver = awscli.clidriver.create_clidriver()\n session = driver.session\n data_path = session.get_config_variable('data_path').split(os.pathsep)\n if not data_path:\n data_path = []\n _LOADER.search_paths.extend(data_path)\n session.register_component('data_loader', _LOADER)\n return driver", "metadata": "root.create_clidriver", "header": "['module', '___EOS___']", "index": 99 }, { "content": "def get_aws_cmd():\n global AWS_CMD\n import awscli\n if AWS_CMD is None:\n # Try <repo>/bin/aws\n repo_root = os.path.dirname(os.path.abspath(awscli.__file__))\n aws_cmd = os.path.join(repo_root, 'bin', 'aws')\n if not os.path.isfile(aws_cmd):\n aws_cmd = _search_path_for_cmd('aws')\n if aws_cmd is None:\n raise ValueError('Could not find \"aws\" executable. Either '\n 'make sure it is on your PATH, or you can '\n 'explicitly set this value using '\n '\"set_aws_cmd()\"')\n AWS_CMD = aws_cmd\n return AWS_CMD", "metadata": "root.get_aws_cmd", "header": "['module', '___EOS___']", "index": 110 }, { "content": "def _search_path_for_cmd(cmd_name):\n for path in os.environ.get('PATH', '').split(os.pathsep):\n full_cmd_path = os.path.join(path, cmd_name)\n if os.path.isfile(full_cmd_path):\n return full_cmd_path\n return None", "metadata": "root._search_path_for_cmd", "header": "['module', '___EOS___']", "index": 128 }, { "content": "def set_aws_cmd(aws_cmd):\n global AWS_CMD\n AWS_CMD = aws_cmd", "metadata": "root.set_aws_cmd", "header": "['module', '___EOS___']", "index": 136 }, { "content": "@contextlib.contextmanager\ndef temporary_file(mode):\n \"\"\"This is a cross platform temporary file creation.\n\n tempfile.NamedTemporary file on windows creates a secure temp file\n that can't be read by other processes and can't be opened a second time.\n\n For tests, we generally *want* them to be read multiple times.\n The test fixture writes the temp file contents, the test reads the\n temp file.\n\n \"\"\"\n temporary_directory = tempfile.mkdtemp()\n basename = 'tmpfile-%s-%s' % (int(time.time()), random.randint(1, 1000))\n full_filename = os.path.join(temporary_directory, basename)\n open(full_filename, 'w').close()\n try:\n with open(full_filename, mode) as f:\n yield f\n finally:\n shutil.rmtree(temporary_directory)", "metadata": "root.temporary_file", "header": "['module', '___EOS___']", "index": 141 }, { "content": "def create_bucket(session, name=None, region=None):\n \"\"\"\n Creates a bucket\n :returns: the name of the bucket created\n \"\"\"\n if not region:\n region = 'us-west-2'\n client = session.create_client('s3', region_name=region)\n if name:\n bucket_name = name\n else:\n rand1 = ''.join(random.sample(string.ascii_lowercase + string.digits,\n 10))\n bucket_name = 'awscli-s3test-' + str(rand1)\n params = {'Bucket': bucket_name}\n if region != 'us-east-1':\n params['CreateBucketConfiguration'] = {'LocationConstraint': region}\n try:\n # To disable the (obsolete) awscli.errorhandler.ClientError behavior\n client.meta.events.unregister(\n 'after-call', unique_id='awscli-error-handler')\n client.create_bucket(**params)\n except ClientError as e:\n if e.response['Error'].get('Code') == 'BucketAlreadyOwnedByYou':\n # This can happen in the retried request, when the first one\n # succeeded on S3 but somehow the response never comes back.\n # We still got a bucket ready for test anyway.\n pass\n else:\n raise\n return bucket_name", "metadata": "root.create_bucket", "header": "['module', '___EOS___']", "index": 164 }, { "content": "class BaseCLIDriverTest(unittest.TestCase):\n \"\"\"Base unittest that use clidriver.\n\n This will load all the default plugins as well so it\n will simulate the behavior the user will see.\n \"\"\"\n", "metadata": "root.BaseCLIDriverTest", "header": "['module', '___EOS___']", "index": 197 }, { "content": " def setUp(self):\n self.environ = {\n 'AWS_DATA_PATH': os.environ['AWS_DATA_PATH'],\n 'AWS_DEFAULT_REGION': 'us-east-1',\n 'AWS_ACCESS_KEY_ID': 'access_key',\n 'AWS_SECRET_ACCESS_KEY': 'secret_key',\n 'AWS_CONFIG_FILE': '',\n }\n self.environ_patch = mock.patch('os.environ', self.environ)\n self.environ_patch.start()\n self.driver = create_clidriver()\n self.session = self.driver.session", "metadata": "root.BaseCLIDriverTest.setUp", "header": "['class', 'BaseCLIDriverTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 203 }, { "content": " def tearDown(self):\n self.environ_patch.stop()", "metadata": "root.BaseCLIDriverTest.tearDown", "header": "['class', 'BaseCLIDriverTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 216 }, { "content": "class BaseAWSHelpOutputTest(BaseCLIDriverTest):\n\n\n\n\n", "metadata": "root.BaseAWSHelpOutputTest", "header": "['module', '___EOS___']", "index": 220 }, { "content": " def setUp(self):\n super(BaseAWSHelpOutputTest, self).setUp()\n self.renderer_patch = mock.patch('awscli.help.get_renderer')\n self.renderer_mock = self.renderer_patch.start()\n self.renderer = CapturedRenderer()\n self.renderer_mock.return_value = self.renderer", "metadata": "root.BaseAWSHelpOutputTest.setUp", "header": "['class', 'BaseAWSHelpOutputTest', '(', 'BaseCLIDriverTest', ')', ':', '___EOS___']", "index": 221 }, { "content": " def tearDown(self):\n super(BaseAWSHelpOutputTest, self).tearDown()\n self.renderer_patch.stop()", "metadata": "root.BaseAWSHelpOutputTest.tearDown", "header": "['class', 'BaseAWSHelpOutputTest', '(', 'BaseCLIDriverTest', ')', ':', '___EOS___']", "index": 228 }, { "content": " def assert_contains(self, contains):\n if contains not in self.renderer.rendered_contents:\n self.fail(\"The expected contents:\\n%s\\nwere not in the \"\n \"actual rendered contents:\\n%s\" % (\n contains, self.renderer.rendered_contents))", "metadata": "root.BaseAWSHelpOutputTest.assert_contains", "header": "['class', 'BaseAWSHelpOutputTest', '(', 'BaseCLIDriverTest', ')', ':', '___EOS___']", "index": 232 }, { "content": " def assert_contains_with_count(self, contains, count):\n r_count = self.renderer.rendered_contents.count(contains)\n if r_count != count:\n self.fail(\"The expected contents:\\n%s\\n, with the \"\n \"count:\\n%d\\nwere not in the actual rendered \"\n \" contents:\\n%s\\nwith count:\\n%d\" % (\n contains, count, self.renderer.rendered_contents, r_count))", "metadata": "root.BaseAWSHelpOutputTest.assert_contains_with_count", "header": "['class', 'BaseAWSHelpOutputTest', '(', 'BaseCLIDriverTest', ')', ':', '___EOS___']", "index": 238 }, { "content": " def assert_not_contains(self, contents):\n if contents in self.renderer.rendered_contents:\n self.fail(\"The contents:\\n%s\\nwere not suppose to be in the \"\n \"actual rendered contents:\\n%s\" % (\n contents, self.renderer.rendered_contents))", "metadata": "root.BaseAWSHelpOutputTest.assert_not_contains", "header": "['class', 'BaseAWSHelpOutputTest', '(', 'BaseCLIDriverTest', ')', ':', '___EOS___']", "index": 246 }, { "content": " def assert_text_order(self, *args, **kwargs):\n # First we need to find where the SYNOPSIS section starts.\n starting_from = kwargs.pop('starting_from')\n args = list(args)\n contents = self.renderer.rendered_contents\n self.assertIn(starting_from, contents)\n start_index = contents.find(starting_from)\n arg_indices = [contents.find(arg, start_index) for arg in args]\n previous = arg_indices[0]\n for i, index in enumerate(arg_indices[1:], 1):\n if index == -1:\n self.fail('The string %r was not found in the contents: %s'\n % (args[index], contents))\n if index < previous:\n self.fail('The string %r came before %r, but was suppose to come '\n 'after it.\\n%s' % (args[i], args[i - 1], contents))\n previous = index", "metadata": "root.BaseAWSHelpOutputTest.assert_text_order", "header": "['class', 'BaseAWSHelpOutputTest', '(', 'BaseCLIDriverTest', ')', ':', '___EOS___']", "index": 252 }, { "content": "class CapturedRenderer(object):\n", "metadata": "root.CapturedRenderer", "header": "['module', '___EOS___']", "index": 271 }, { "content": " def __init__(self):\n self.rendered_contents = ''", "metadata": "root.CapturedRenderer.__init__", "header": "['class', 'CapturedRenderer', '(', 'object', ')', ':', '___EOS___']", "index": 272 }, { "content": " def render(self, contents):\n self.rendered_contents = contents.decode('utf-8')", "metadata": "root.CapturedRenderer.render", "header": "['class', 'CapturedRenderer', '(', 'object', ')', ':', '___EOS___']", "index": 275 }, { "content": "class CapturedOutput(object):", "metadata": "root.CapturedOutput", "header": "['module', '___EOS___']", "index": 279 }, { "content": " def __init__(self, stdout, stderr):\n self.stdout = stdout\n self.stderr = stderr", "metadata": "root.CapturedOutput.__init__", "header": "['class', 'CapturedOutput', '(', 'object', ')', ':', '___EOS___']", "index": 280 }, { "content": "@contextlib.contextmanager\ndef capture_output():\n stderr = six.StringIO()\n stdout = six.StringIO()\n with mock.patch('sys.stderr', stderr):\n with mock.patch('sys.stdout', stdout):\n yield CapturedOutput(stdout, stderr)", "metadata": "root.capture_output", "header": "['module', '___EOS___']", "index": 285 }, { "content": "class BaseAWSCommandParamsTest(unittest.TestCase):\n maxDiff = None\n\n\n\n\n\n\n\n", "metadata": "root.BaseAWSCommandParamsTest", "header": "['module', '___EOS___']", "index": 294 }, { "content": " def setUp(self):\n self.last_params = {}\n # awscli/__init__.py injects AWS_DATA_PATH at import time\n # so that we can find cli.json. This might be fixed in the\n # future, but for now we just grab that value out of the real\n # os.environ so the patched os.environ has this data and\n # the CLI works.\n self.environ = {\n 'AWS_DATA_PATH': os.environ['AWS_DATA_PATH'],\n 'AWS_DEFAULT_REGION': 'us-east-1',\n 'AWS_ACCESS_KEY_ID': 'access_key',\n 'AWS_SECRET_ACCESS_KEY': 'secret_key',\n }\n self.environ_patch = mock.patch('os.environ', self.environ)\n self.environ_patch.start()\n self.http_response = requests.models.Response()\n self.http_response.status_code = 200\n self.parsed_response = {}\n self.make_request_patch = mock.patch('botocore.endpoint.Endpoint.make_request')\n self.make_request_is_patched = False\n self.operations_called = []\n self.parsed_responses = None\n self.driver = create_clidriver()", "metadata": "root.BaseAWSCommandParamsTest.setUp", "header": "['class', 'BaseAWSCommandParamsTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 297 }, { "content": " def tearDown(self):\n # This clears all the previous registrations.\n self.environ_patch.stop()\n if self.make_request_is_patched:\n self.make_request_patch.stop()\n self.make_request_is_patched = False", "metadata": "root.BaseAWSCommandParamsTest.tearDown", "header": "['class', 'BaseAWSCommandParamsTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 321 }, { "content": " def before_call(self, params, **kwargs):\n self._store_params(params)", "metadata": "root.BaseAWSCommandParamsTest.before_call", "header": "['class', 'BaseAWSCommandParamsTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 328 }, { "content": " def _store_params(self, params):\n self.last_request_dict = params\n self.last_params = params['body']", "metadata": "root.BaseAWSCommandParamsTest._store_params", "header": "['class', 'BaseAWSCommandParamsTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 331 }, { "content": " def patch_make_request(self):\n # If you do not stop a previously started patch,\n # it can never be stopped if you call start() again on the same\n # patch again...\n # So stop the current patch before calling start() on it again.\n if self.make_request_is_patched:\n self.make_request_patch.stop()\n self.make_request_is_patched = False\n make_request_patch = self.make_request_patch.start()\n if self.parsed_responses is not None:\n make_request_patch.side_effect = lambda *args, **kwargs: \\\n (self.http_response, self.parsed_responses.pop(0))\n else:\n make_request_patch.return_value = (self.http_response, self.parsed_response)\n self.make_request_is_patched = True", "metadata": "root.BaseAWSCommandParamsTest.patch_make_request", "header": "['class', 'BaseAWSCommandParamsTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 335 }, { "content": " def assert_params_for_cmd(self, cmd, params=None, expected_rc=0,\n stderr_contains=None, ignore_params=None):\n stdout, stderr, rc = self.run_cmd(cmd, expected_rc)\n if stderr_contains is not None:\n self.assertIn(stderr_contains, stderr)\n if params is not None:\n # The last kwargs of Operation.call() in botocore.\n last_kwargs = copy.copy(self.last_kwargs)\n if ignore_params is not None:\n for key in ignore_params:\n try:\n del last_kwargs[key]\n except KeyError:\n pass\n if params != last_kwargs:\n self.fail(\"Actual params did not match expected params.\\n\"\n \"Expected:\\n\\n\"\n \"%s\\n\"\n \"Actual:\\n\\n%s\\n\" % (\n pformat(params), pformat(last_kwargs)))\n return stdout, stderr, rc", "metadata": "root.BaseAWSCommandParamsTest.assert_params_for_cmd", "header": "['class', 'BaseAWSCommandParamsTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 351 }, { "content": " def before_parameter_build(self, params, model, **kwargs):\n self.last_kwargs = params\n self.operations_called.append((model, params))", "metadata": "root.BaseAWSCommandParamsTest.before_parameter_build", "header": "['class', 'BaseAWSCommandParamsTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 373 }, { "content": " def run_cmd(self, cmd, expected_rc=0):\n logging.debug(\"Calling cmd: %s\", cmd)\n self.patch_make_request()\n self.driver.session.register('before-call', self.before_call)\n self.driver.session.register('before-parameter-build',\n self.before_parameter_build)\n if not isinstance(cmd, list):\n cmdlist = cmd.split()\n else:\n cmdlist = cmd\n\n with capture_output() as captured:\n try:\n rc = self.driver.main(cmdlist)\n except SystemExit as e:\n # We need to catch SystemExit so that we\n # can get a proper rc and still present the\n # stdout/stderr to the test runner so we can\n # figure out what went wrong.\n rc = e.code\n stderr = captured.stderr.getvalue()\n stdout = captured.stdout.getvalue()\n self.assertEqual(\n rc, expected_rc,\n \"Unexpected rc (expected: %s, actual: %s) for command: %s\\n\"\n \"stdout:\\n%sstderr:\\n%s\" % (\n expected_rc, rc, cmd, stdout, stderr))\n return stdout, stderr, rc", "metadata": "root.BaseAWSCommandParamsTest.run_cmd", "header": "['class', 'BaseAWSCommandParamsTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 377 }, { "content": "class BaseAWSPreviewCommandParamsTest(BaseAWSCommandParamsTest):\n", "metadata": "root.BaseAWSPreviewCommandParamsTest", "header": "['module', '___EOS___']", "index": 407 }, { "content": " def setUp(self):\n self.preview_patch = mock.patch(\n 'awscli.customizations.preview.mark_as_preview')\n self.preview_patch.start()\n super(BaseAWSPreviewCommandParamsTest, self).setUp()", "metadata": "root.BaseAWSPreviewCommandParamsTest.setUp", "header": "['class', 'BaseAWSPreviewCommandParamsTest', '(', 'BaseAWSCommandParamsTest', ')', ':', '___EOS___']", "index": 408 }, { "content": " def tearDown(self):\n self.preview_patch.stop()\n super(BaseAWSPreviewCommandParamsTest, self).tearDown()", "metadata": "root.BaseAWSPreviewCommandParamsTest.tearDown", "header": "['class', 'BaseAWSPreviewCommandParamsTest', '(', 'BaseAWSCommandParamsTest', ')', ':', '___EOS___']", "index": 414 }, { "content": "class FileCreator(object):\n\n\n\n", "metadata": "root.FileCreator", "header": "['module', '___EOS___']", "index": 419 }, { "content": " def __init__(self):\n self.rootdir = tempfile.mkdtemp()", "metadata": "root.FileCreator.__init__", "header": "['class', 'FileCreator', '(', 'object', ')', ':', '___EOS___']", "index": 420 }, { "content": " def remove_all(self):\n shutil.rmtree(self.rootdir)", "metadata": "root.FileCreator.remove_all", "header": "['class', 'FileCreator', '(', 'object', ')', ':', '___EOS___']", "index": 423 }, { "content": " def create_file(self, filename, contents, mtime=None, mode='w'):\n \"\"\"Creates a file in a tmpdir\n\n ``filename`` should be a relative path, e.g. \"foo/bar/baz.txt\"\n It will be translated into a full path in a tmp dir.\n\n If the ``mtime`` argument is provided, then the file's\n mtime will be set to the provided value (must be an epoch time).\n Otherwise the mtime is left untouched.\n\n ``mode`` is the mode the file should be opened either as ``w`` or\n `wb``.\n\n Returns the full path to the file.\n\n \"\"\"\n full_path = os.path.join(self.rootdir, filename)\n if not os.path.isdir(os.path.dirname(full_path)):\n os.makedirs(os.path.dirname(full_path))\n with open(full_path, mode) as f:\n f.write(contents)\n current_time = os.path.getmtime(full_path)\n # Subtract a few years off the last modification date.\n os.utime(full_path, (current_time, current_time - 100000000))\n if mtime is not None:\n os.utime(full_path, (mtime, mtime))\n return full_path", "metadata": "root.FileCreator.create_file", "header": "['class', 'FileCreator', '(', 'object', ')', ':', '___EOS___']", "index": 426 }, { "content": " def append_file(self, filename, contents):\n \"\"\"Append contents to a file\n\n ``filename`` should be a relative path, e.g. \"foo/bar/baz.txt\"\n It will be translated into a full path in a tmp dir.\n\n Returns the full path to the file.\n \"\"\"\n full_path = os.path.join(self.rootdir, filename)\n if not os.path.isdir(os.path.dirname(full_path)):\n os.makedirs(os.path.dirname(full_path))\n with open(full_path, 'a') as f:\n f.write(contents)\n return full_path", "metadata": "root.FileCreator.append_file", "header": "['class', 'FileCreator', '(', 'object', ')', ':', '___EOS___']", "index": 454 }, { "content": " def full_path(self, filename):\n \"\"\"Translate relative path to full path in temp dir.\n\n f.full_path('foo/bar.txt') -> /tmp/asdfasd/foo/bar.txt\n \"\"\"\n return os.path.join(self.rootdir, filename)", "metadata": "root.FileCreator.full_path", "header": "['class', 'FileCreator', '(', 'object', ')', ':', '___EOS___']", "index": 469 }, { "content": "class ProcessTerminatedError(Exception):\n pass", "metadata": "root.ProcessTerminatedError", "header": "['module', '___EOS___']", "index": 477 }, { "content": "class Result(object):\n", "metadata": "root.Result", "header": "['module', '___EOS___']", "index": 481 }, { "content": " def __init__(self, rc, stdout, stderr, memory_usage=None):\n self.rc = rc\n self.stdout = stdout\n self.stderr = stderr\n INTEG_LOG.debug(\"rc: %s\", rc)\n INTEG_LOG.debug(\"stdout: %s\", stdout)\n INTEG_LOG.debug(\"stderr: %s\", stderr)\n if memory_usage is None:\n memory_usage = []\n self.memory_usage = memory_usage", "metadata": "root.Result.__init__", "header": "['class', 'Result', '(', 'object', ')', ':', '___EOS___']", "index": 482 }, { "content": " @property\n def json(self):\n return json.loads(self.stdout)", "metadata": "root.Result.json", "header": "['class', 'Result', '(', 'object', ')', ':', '___EOS___']", "index": 493 }, { "content": "def _escape_quotes(command):\n # For windows we have different rules for escaping.\n # First, double quotes must be escaped.\n command = command.replace('\"', '\\\\\"')\n # Second, single quotes do nothing, to quote a value we need\n # to use double quotes.\n command = command.replace(\"'\", '\"')\n return command", "metadata": "root._escape_quotes", "header": "['module', '___EOS___']", "index": 498 }, { "content": "def aws(command, collect_memory=False, env_vars=None,\n wait_for_finish=True, input_data=None, input_file=None):\n \"\"\"Run an aws command.\n\n This help function abstracts the differences of running the \"aws\"\n command on different platforms.\n\n If collect_memory is ``True`` the the Result object will have a list\n of memory usage taken at 2 second intervals. The memory usage\n will be in bytes.\n\n If env_vars is None, this will set the environment variables\n to be used by the aws process.\n\n If wait_for_finish is False, then the Process object is returned\n to the caller. It is then the caller's responsibility to ensure\n proper cleanup. This can be useful if you want to test timeout's\n or how the CLI responds to various signals.\n\n :type input_data: string\n :param input_data: This string will be communicated to the process through\n the stdin of the process. It essentially allows the user to\n avoid having to use a file handle to pass information to the process.\n Note that this string is not passed on creation of the process, but\n rather communicated to the process.\n\n :type input_file: a file handle\n :param input_file: This is a file handle that will act as the\n the stdin of the process immediately on creation. Essentially\n any data written to the file will be read from stdin of the\n process. This is needed if you plan to stream data into stdin while\n collecting memory.\n \"\"\"\n if platform.system() == 'Windows':\n command = _escape_quotes(command)\n if 'AWS_TEST_COMMAND' in os.environ:\n aws_command = os.environ['AWS_TEST_COMMAND']\n else:\n aws_command = 'python %s' % get_aws_cmd()\n full_command = '%s %s' % (aws_command, command)\n stdout_encoding = get_stdout_encoding()\n if isinstance(full_command, six.text_type) and not six.PY3:\n full_command = full_command.encode(stdout_encoding)\n INTEG_LOG.debug(\"Running command: %s\", full_command)\n env = os.environ.copy()\n env['AWS_DEFAULT_REGION'] = \"us-east-1\"\n if env_vars is not None:\n env = env_vars\n if input_file is None:\n input_file = PIPE\n process = Popen(full_command, stdout=PIPE, stderr=PIPE, stdin=input_file,\n shell=True, env=env)\n if not wait_for_finish:\n return process\n memory = None\n if not collect_memory:\n kwargs = {}\n if input_data:\n kwargs = {'input': input_data}\n stdout, stderr = process.communicate(**kwargs)\n else:\n stdout, stderr, memory = _wait_and_collect_mem(process)\n return Result(process.returncode,\n stdout.decode(stdout_encoding),\n stderr.decode(stdout_encoding),\n memory)", "metadata": "root.aws", "header": "['module', '___EOS___']", "index": 508 }, { "content": "def get_stdout_encoding():\n encoding = getattr(sys.__stdout__, 'encoding', None)\n if encoding is None:\n encoding = 'utf-8'\n return encoding", "metadata": "root.get_stdout_encoding", "header": "['module', '___EOS___']", "index": 576 }, { "content": "def _wait_and_collect_mem(process):\n # We only know how to collect memory on mac/linux.\n if platform.system() == 'Darwin':\n get_memory = _get_memory_with_ps\n elif platform.system() == 'Linux':\n get_memory = _get_memory_with_ps\n else:\n raise ValueError(\n \"Can't collect memory for process on platform %s.\" %\n platform.system())\n memory = []\n while process.poll() is None:\n try:\n current = get_memory(process.pid)\n except ProcessTerminatedError:\n # It's possible the process terminated between .poll()\n # and get_memory().\n break\n memory.append(current)\n stdout, stderr = process.communicate()\n return stdout, stderr, memory", "metadata": "root._wait_and_collect_mem", "header": "['module', '___EOS___']", "index": 583 }, { "content": "def _get_memory_with_ps(pid):\n # It's probably possible to do with proc_pidinfo and ctypes on a Mac,\n # but we'll do it the easy way with parsing ps output.\n command_list = 'ps u -p'.split()\n command_list.append(str(pid))\n p = Popen(command_list, stdout=PIPE)\n stdout = p.communicate()[0]\n if not p.returncode == 0:\n raise ProcessTerminatedError(str(pid))\n else:\n # Get the RSS from output that looks like this:\n # USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND\n # user 47102 0.0 0.1 2437000 4496 s002 S+ 7:04PM 0:00.12 python2.6\n return int(stdout.splitlines()[1].split()[5]) * 1024", "metadata": "root._get_memory_with_ps", "header": "['module', '___EOS___']", "index": 606 }, { "content": "class BaseS3CLICommand(unittest.TestCase):\n \"\"\"Base class for aws s3 command.\n\n This contains convenience functions to make writing these tests easier\n and more streamlined.\n\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.BaseS3CLICommand", "header": "['module', '___EOS___']", "index": 622 }, { "content": " def setUp(self):\n self.files = FileCreator()\n self.session = botocore.session.get_session()\n self.regions = {}\n self.region = 'us-west-2'\n self.client = self.session.create_client('s3', region_name=self.region)\n self.extra_setup()", "metadata": "root.BaseS3CLICommand.setUp", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 630 }, { "content": " def extra_setup(self):\n # Subclasses can use this to define extra setup steps.\n pass", "metadata": "root.BaseS3CLICommand.extra_setup", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 638 }, { "content": " def tearDown(self):\n self.files.remove_all()\n self.extra_teardown()", "metadata": "root.BaseS3CLICommand.tearDown", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 642 }, { "content": " def extra_teardown(self):\n # Subclasses can use this to define extra teardown steps.\n pass", "metadata": "root.BaseS3CLICommand.extra_teardown", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 646 }, { "content": " def create_client_for_bucket(self, bucket_name):\n region = self.regions.get(bucket_name, self.region)\n client = self.session.create_client('s3', region_name=region)\n return client", "metadata": "root.BaseS3CLICommand.create_client_for_bucket", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 650 }, { "content": " def assert_key_contents_equal(self, bucket, key, expected_contents):\n if isinstance(expected_contents, six.BytesIO):\n expected_contents = expected_contents.getvalue().decode('utf-8')\n actual_contents = self.get_key_contents(bucket, key)\n # The contents can be huge so we try to give helpful error messages\n # without necessarily printing the actual contents.\n self.assertEqual(len(actual_contents), len(expected_contents))\n if actual_contents != expected_contents:\n self.fail(\"Contents for %s/%s do not match (but they \"\n \"have the same length)\" % (bucket, key))", "metadata": "root.BaseS3CLICommand.assert_key_contents_equal", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 655 }, { "content": " def create_bucket(self, name=None, region=None):\n if not region:\n region = self.region\n bucket_name = create_bucket(self.session, name, region)\n self.regions[bucket_name] = region\n self.addCleanup(self.delete_bucket, bucket_name)\n return bucket_name", "metadata": "root.BaseS3CLICommand.create_bucket", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 666 }, { "content": " def put_object(self, bucket_name, key_name, contents='', extra_args=None):\n client = self.create_client_for_bucket(bucket_name)\n call_args = {\n 'Bucket': bucket_name,\n 'Key': key_name, 'Body': contents\n }\n if extra_args is not None:\n call_args.update(extra_args)\n response = client.put_object(**call_args)\n self.addCleanup(self.delete_key, bucket_name, key_name)", "metadata": "root.BaseS3CLICommand.put_object", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 674 }, { "content": " def delete_bucket(self, bucket_name):\n self.remove_all_objects(bucket_name)\n client = self.create_client_for_bucket(bucket_name)\n response = client.delete_bucket(Bucket=bucket_name)\n self.regions.pop(bucket_name, None)", "metadata": "root.BaseS3CLICommand.delete_bucket", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 685 }, { "content": " def remove_all_objects(self, bucket_name):\n client = self.create_client_for_bucket(bucket_name)\n paginator = client.get_paginator('list_objects')\n pages = paginator.paginate(Bucket=bucket_name)\n key_names = []\n for page in pages:\n key_names += [obj['Key'] for obj in page.get('Contents', [])]\n for key_name in key_names:\n self.delete_key(bucket_name, key_name)", "metadata": "root.BaseS3CLICommand.remove_all_objects", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 691 }, { "content": " def delete_key(self, bucket_name, key_name):\n client = self.create_client_for_bucket(bucket_name)\n response = client.delete_object(Bucket=bucket_name, Key=key_name)", "metadata": "root.BaseS3CLICommand.delete_key", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 701 }, { "content": " def get_key_contents(self, bucket_name, key_name):\n client = self.create_client_for_bucket(bucket_name)\n response = client.get_object(Bucket=bucket_name, Key=key_name)\n return response['Body'].read().decode('utf-8')", "metadata": "root.BaseS3CLICommand.get_key_contents", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 705 }, { "content": " def key_exists(self, bucket_name, key_name):\n client = self.create_client_for_bucket(bucket_name)\n try:\n client.head_object(Bucket=bucket_name, Key=key_name)\n return True\n except ClientError:\n return False", "metadata": "root.BaseS3CLICommand.key_exists", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 710 }, { "content": " def list_buckets(self):\n response = self.client.list_buckets()\n return response['Buckets']", "metadata": "root.BaseS3CLICommand.list_buckets", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 718 }, { "content": " def content_type_for_key(self, bucket_name, key_name):\n parsed = self.head_object(bucket_name, key_name)\n return parsed['ContentType']", "metadata": "root.BaseS3CLICommand.content_type_for_key", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 722 }, { "content": " def head_object(self, bucket_name, key_name):\n client = self.create_client_for_bucket(bucket_name)\n response = client.head_object(Bucket=bucket_name, Key=key_name)\n return response", "metadata": "root.BaseS3CLICommand.head_object", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 726 }, { "content": " def assert_no_errors(self, p):\n self.assertEqual(\n p.rc, 0,\n \"Non zero rc (%s) received: %s\" % (p.rc, p.stdout + p.stderr))\n self.assertNotIn(\"Error:\", p.stderr)\n self.assertNotIn(\"failed:\", p.stderr)\n self.assertNotIn(\"client error\", p.stderr)\n self.assertNotIn(\"server error\", p.stderr)", "metadata": "root.BaseS3CLICommand.assert_no_errors", "header": "['class', 'BaseS3CLICommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 731 }, { "content": "class StringIOWithFileNo(StringIO):", "metadata": "root.StringIOWithFileNo", "header": "['module', '___EOS___']", "index": 741 }, { "content": " def fileno(self):\n return 0", "metadata": "root.StringIOWithFileNo.fileno", "header": "['class', 'StringIOWithFileNo', '(', 'StringIO', ')', ':', '___EOS___']", "index": 742 } ]
[ { "span": "from botocore.hooks import HierarchicalEmitter", "start_line": 49, "start_column": 0, "end_line": 49, "end_column": 46 }, { "span": "from botocore.session import Session", "start_line": 50, "start_column": 0, "end_line": 50, "end_column": 36 }, { "span": "from awscli.plugin import load_plugins", "start_line": 56, "start_column": 0, "end_line": 56, "end_column": 38 }, { "span": "from awscli.clidriver import CLIDriver", "start_line": 57, "start_column": 0, "end_line": 57, "end_column": 38 }, { "span": "from awscli import EnvironmentVariables", "start_line": 58, "start_column": 0, "end_line": 58, "end_column": 39 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", "-", "2014", " ", "Ama", "zon", ".", "com", ",", " ", "Inc", ".", " ", "or", " ", "its", " ", "affi", "liat", "es", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\")", ".", " ", "You", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "A", " ", "copy", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "License", " ", "is", " ", "located", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "aws", ".", "amaz", "on", ".", "com", "/", "apa", "che", "2.0", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "in", " ", "the", " ", "\"", "license", "\"", " ", "file", " ", "accom", "pan", "ying", " ", "this", " ", "file", ".", " ", "Thi", "s", " ", "file", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Test", " ", "util", "iti", "es", " ", "for", " ", "the", " ", "AW", "S", " ", "CLI", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "module", " ", "include", "s", " ", "vari", "ous", " ", "classe", "s", "/", "function", "s", " ", "tha", "t", " ", "help", " ", "in", " ", "writ", "ing", "\\", "10", ";", "CLI", " ", "unit", "/", "integrati", "on", " ", "tests", ".", " ", " ", "Thi", "s", " ", "module", " ", "shou", "ld", " ", "not", " ", "be", " ", "import", "ed", " ", "by", "\\", "10", ";", "any", " ", "module", " ", "**", "except", "**", " ", "for", " ", "test", " ", "code", ".", " ", " ", "Thi", "s", " ", "is", " ", "include", "d", " ", "in", " ", "the", " ", "CLI", "\\", "10", ";", "package", " ", "so", " ", "tha", "t", " ", "code", " ", "tha", "t", " ", "is", " ", "not", " ", "part", " ", "of", " ", "the", " ", "CLI", " ", "can", " ", "still", " ", "take", "\\", "10", ";", "advantage", " ", "of", " ", "all", " ", "the", " ", "testi", "ng", " ", "util", "iti", "es", " ", "we", " ", "provide", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "contextlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pprint_", "import_", "pformat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "subprocess_", "import_", "Popen_", ",_", "PIPE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "aws", "cli_", "._", "compat_", "import_", "String", "IO_", "\\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 ", " _", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", " ", "the", " ", "off", " ", "chan", "ce", " ", "somet", "hing", " ", "import", "s", " ", "this", " ", "module_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", "'", "s", " ", "not", " ", "supp", "ose", " ", "to", ",", " ", "we", " ", "shou", "ld", " ", "not", " ", "stop", " ", "the", " ", "CLI_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "rais", "ing", " ", "an", " ", "Import", "Error", ".", " ", " ", "No", "w", " ", "if", " ", "anyt", "hing", " ", "actual", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", "use", "s", "*", " ", "this", " ", "module", " ", "tha", "t", " ", "isn", "'", "t", " ", "supp", "ose", " ", "to", ",", " ", "tha", "t", "'", "s", " ", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "different", " ", "stor", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "aws", "cli_", "._", "compat_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "botocore", "_", "._", "hooks_", "import_", "Hier", "archi", "cal", "Emitte", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "botocore", "_", "._", "session_", "import_", "Session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "botocore", "_", "._", "exceptions_", "import_", "Client", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "botocore", "_", "._", "loaders_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "botocore", "_", "._", "vendor", "ed_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "aws", "cli_", "._", "cli", "driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aws", "cli_", "._", "plugin_", "import_", "load", "\\u", "plugins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aws", "cli_", "._", "cli", "driver_", "import_", "CLI", "Driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aws", "cli_", "import_", "Environ", "ment", "Variables_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "unittest", " ", "module", " ", "got", " ", "a", " ", "significant", " ", "over", "hau", "l_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "2.7", ",", " ", "so", " ", "if", " ", "we", "'", "re", " ", "in", " ", "2.6", " ", "we", " ", "can", " ", "use", " ", "the", " ", "backp", "orted_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "version", " ", "unittest", "2._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", ":_", "2_", "]_", "==_", "(_", "2_", ",_", "6_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "unittest2_", "as_", "unittest_", "\\u\\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_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "python", " ", "3", ",", " ", "order", " ", "matte", "rs", " ", "whe", "n", " ", "calling", " ", "assert", "Equal", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compare", " ", "lists", " ", "and", " ", "dictionar", "ies", " ", "with", " ", "lists", ".", " ", "There", "fore", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "Item", "s", "Equal", " ", "need", "s", " ", "to", " ", "be", " ", "used", " ", "but", " ", "it", " ", "is", " ", "renamed", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "Count", "Equal", " ", "in", " ", "python", " ", "3._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "six_", "._", "PY", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "Test", "Case_", "._", "assert", "Count", "Equal_", "=_", "unittest_", "._", "Test", "Case_", "._", "assert", "Item", "s", "Equal_", "\\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", "LOADER", "_", "=_", "botocore", "_", "._", "loaders_", "._", "Loader_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INTEG", "\\u", "LOG_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "aws", "cli", ".", "tests", ".", "integrati", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AW", "S", "\\u", "CMD_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "skip", "\\u", "if", "\\u", "windows_", "(_", "reason_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Decorat", "or", " ", "to", " ", "skip", " ", "tests", " ", "tha", "t", " ", "shou", "ld", " ", "not", " ", "be", " ", "run", " ", "on", " ", "windows", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ple", " ", "usage", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "skip", "\\u", "if", "\\u", "windows", "(\"", "Not", " ", "valid", "\")", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "test\\u", "some", "\\u", "non", "\\u", "windows", "\\u", "stu", "ff", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "assert", "Equal", "(...)", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "decorator_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unittest_", "._", "skip", "If_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "platform_", "._", "system_", "(_", ")_", "not_", "in_", "[_", "'", "Dar", "win", "'_", ",_", "'", "Lin", "ux", "'_", "]_", ",_", "reason_", ")_", "(_", "func_", ")_", "\\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_", "create", "\\u", "cli", "driver_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "driver_", "=_", "aws", "cli_", "._", "cli", "driver_", "._", "create", "\\u", "cli", "driver_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "=_", "driver_", "._", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "path_", "=_", "session_", "._", "get", "\\u", "config", "\\u", "variable_", "(_", "'", "data\\u", "path", "'_", ")_", "._", "split_", "(_", "os_", "._", "pathsep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "path_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "LOADER", "_", "._", "search", "\\u", "paths_", "._", "extend_", "(_", "data\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "register", "\\u", "component_", "(_", "'", "data\\u", "load", "er", "'_", ",_", "\\u", "LOADER", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "driver_", "\\u\\u\\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", "aws", "\\u", "cmd_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "AW", "S", "\\u", "CMD_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "aws", "cli_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "AW", "S", "\\u", "CMD_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "<", "repo", ">/", "bin", "/", "aws_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repo", "\\u", "root_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "aws", "cli_", "._", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aws", "\\u", "cmd_", "=_", "os_", "._", "path_", "._", "join_", "(_", "repo", "\\u", "root_", ",_", "'", "bin", "'_", ",_", "'", "aws", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "aws", "\\u", "cmd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aws", "\\u", "cmd_", "=_", "\\u", "search", "\\u", "path", "\\u", "for", "\\u", "cmd_", "(_", "'", "aws", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "aws", "\\u", "cmd_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "\"", "aws", "\"", " ", "executable", ".", " ", " ", "Ei", "ther", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", " ", "sure", " ", "it", " ", "is", " ", "on", " ", "your", " ", "PATH", ",", " ", "or", " ", "you", " ", "can", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "explicit", "ly", " ", "set", " ", "this", " ", "value", " ", "usi", "ng", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\"", "set\\u", "aws", "\\u", "cmd", "()\"", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "AW", "S", "\\u", "CMD_", "=_", "aws", "\\u", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "AW", "S", "\\u", "CMD_", "\\u\\u\\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", "search", "\\u", "path", "\\u", "for", "\\u", "cmd_", "(_", "cmd", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "path_", "in_", "os_", "._", "environ_", "._", "get_", "(_", "'", "PATH", "'_", ",_", "''_", ")_", "._", "split_", "(_", "os_", "._", "pathsep_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full", "\\u", "cmd", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "cmd", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "full", "\\u", "cmd", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "full", "\\u", "cmd", "\\u", "path_", "\\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]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "aws", "\\u", "cmd_", "(_", "aws", "\\u", "cmd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "AW", "S", "\\u", "CMD_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AW", "S", "\\u", "CMD_", "=_", "aws", "\\u", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "contextlib_", "._", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "temporar", "y", "\\u", "file_", "(_", "mode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "is", " ", "a", " ", "cross", " ", "platform", " ", "temporar", "y", " ", "file", " ", "creati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "tempfile", ".", "Name", "d", "Tempora", "ry", " ", "file", " ", "on", " ", "windows", " ", "create", "s", " ", "a", " ", "secure", " ", "temp", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "can", "'", "t", " ", "be", " ", "read", " ", "by", " ", "other", " ", "process", "es", " ", "and", " ", "can", "'", "t", " ", "be", " ", "opene", "d", " ", "a", " ", "second", " ", "time", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "tests", ",", " ", "we", " ", "genera", "ll", "y", " ", "*", "want", "*", " ", "them", " ", "to", " ", "be", " ", "read", " ", "multiple", " ", "times", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "test", " ", "fixture", " ", "writes", " ", "the", " ", "temp", " ", "file", " ", "content", "s", ",", " ", "the", " ", "test", " ", "reads", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "temp", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temporar", "y", "\\u", "directory_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "basename_", "=_", "'", "tmpfile", "-%", "s", "-%", "s", "'_", "%_", "(_", "int_", "(_", "time_", "._", "time_", "(_", ")_", ")_", ",_", "random_", "._", "randint_", "(_", "1_", ",_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "\\u", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "temporar", "y", "\\u", "directory_", ",_", "basename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "full", "\\u", "filename_", ",_", "'", "w", "'_", ")_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "full", "\\u", "filename_", ",_", "mode_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "temporar", "y", "\\u", "directory_", ")_", "\\u\\u\\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", "\\u", "bucket_", "(_", "session_", ",_", "name_", "=_", "None_", ",_", "region_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "bucket", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "the", " ", "name", " ", "of", " ", "the", " ", "bucket", " ", "created", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "region_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "region_", "=_", "'", "us", "-", "west", "-", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "client_", "=_", "session_", "._", "create", "\\u", "client_", "(_", "'", "s3", "'_", ",_", "region", "\\u", "name_", "=_", "region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bucket", "\\u", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rand", "1_", "=_", "''_", "._", "join_", "(_", "random_", "._", "sample_", "(_", "string_", "._", "ascii", "\\u", "lowercase_", "+_", "string_", "._", "digits_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bucket", "\\u", "name_", "=_", "'", "aws", "cli", "-", "s3", "test", "-'_", "+_", "str_", "(_", "rand", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "params_", "=_", "{_", "'", "Buck", "et", "'_", ":_", "bucket", "\\u", "name_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "region_", "!=_", "'", "us", "-", "east", "-1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "[_", "'", "Creat", "e", "Buck", "et", "Configura", "tion", "'_", "]_", "=_", "{_", "'", "Locat", "ion", "Constr", "aint", "'_", ":_", "region_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "To", " ", "disable", " ", "the", " ", "(", "obsolete", ")", " ", "aws", "cli", ".", "error", "handler", ".", "Client", "Error", " ", "behavior_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "._", "meta_", "._", "events_", "._", "unregister_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "after", "-", "call", "'_", ",_", "unique", "\\u", "id_", "=_", "'", "aws", "cli", "-", "error", "-", "handler", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "create", "\\u", "bucket_", "(_", "**_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Client", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "response_", "[_", "'", "Error", "'_", "]_", "._", "get_", "(_", "'", "Code", "'_", ")_", "==_", "'", "Buck", "et", "Al", "read", "y", "Owne", "d", "By", "You", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "can", " ", "happ", "en", " ", "in", " ", "the", " ", "retrie", "d", " ", "request", ",", " ", "whe", "n", " ", "the", " ", "first", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "succe", "eded", " ", "on", " ", "S", "3", " ", "but", " ", "some", "how", " ", "the", " ", "response", " ", "neve", "r", " ", "come", "s", " ", "back", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "still", " ", "got", " ", "a", " ", "bucket", " ", "read", "y", " ", "for", " ", "test", " ", "anyway", "._", "\\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 ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "bucket", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "CLI", "Drive", "r", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "unittest", " ", "tha", "t", " ", "use", " ", "cli", "driver", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "load", " ", "all", " ", "the", " ", "default", " ", "plugin", "s", " ", "as", " ", "well", " ", "so", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "simulat", "e", " ", "the", " ", "behavior", " ", "the", " ", "user", " ", "will", " ", "see", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "CLI", "Drive", "r", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\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_", "._", "environ_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AW", "S", "\\u", "DATA", "\\u", "PATH", "'_", ":_", "os_", "._", "environ_", "[_", "'", "AW", "S", "\\u", "DATA", "\\u", "PATH", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AW", "S", "\\u", "DEF", "AUL", "T", "\\u", "REGION", "'_", ":_", "'", "us", "-", "east", "-1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AW", "S", "\\u", "ACCESS", "\\u", "KEY", "\\u", "ID", "'_", ":_", "'", "access", "\\u", "key", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AW", "S", "\\u", "SEC", "RET", "\\u", "ACCESS", "\\u", "KEY", "'_", ":_", "'", "secret", "\\u", "key", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AW", "S", "\\u", "CONFIG", "\\u", "FILE", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "environ", "\\u", "patch_", "=_", "mock_", "._", "patch_", "(_", "'", "os", ".", "environ", "'_", ",_", "self_", "._", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "environ", "\\u", "patch_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "=_", "create", "\\u", "cli", "driver_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "=_", "self_", "._", "driver_", "._", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "CLI", "Drive", "r", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "environ", "\\u", "patch_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "AW", "SH", "elp", "Output", "Test_", "(_", "Base", "CLI", "Drive", "r", "Test_", ")_", ":_", "\\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_", "[SEP]_", "class_", "Base", "AW", "SH", "elp", "Output", "Test_", "(_", "Base", "CLI", "Drive", "r", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Base", "AW", "SH", "elp", "Output", "Test_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "render", "er", "\\u", "patch_", "=_", "mock_", "._", "patch_", "(_", "'", "aws", "cli", ".", "help", ".", "get", "\\u", "render", "er", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "render", "er", "\\u", "mock_", "=_", "self_", "._", "render", "er", "\\u", "patch_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "renderer_", "=_", "Captur", "ed", "Renderer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "render", "er", "\\u", "mock_", "._", "return", "\\u", "value_", "=_", "self_", "._", "renderer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "AW", "SH", "elp", "Output", "Test_", "(_", "Base", "CLI", "Drive", "r", "Test_", ")_", ":_", "\\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 ", " _", "super_", "(_", "Base", "AW", "SH", "elp", "Output", "Test_", ",_", "self_", ")_", "._", "tear", "Down_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "render", "er", "\\u", "patch_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "AW", "SH", "elp", "Output", "Test_", "(_", "Base", "CLI", "Drive", "r", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "contains_", "(_", "self_", ",_", "contains_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contains_", "not_", "in_", "self_", "._", "renderer_", "._", "render", "ed", "\\u", "contents_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "The", " ", "expected", " ", "content", "s", ":\\\\", "n", "%", "s", "\\\\", "nw", "ere", " ", "not", " ", "in", " ", "the", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "actual", " ", "render", "ed", " ", "content", "s", ":\\\\", "n", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "contains_", ",_", "self_", "._", "renderer_", "._", "render", "ed", "\\u", "contents_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "AW", "SH", "elp", "Output", "Test_", "(_", "Base", "CLI", "Drive", "r", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "contain", "s", "\\u", "with", "\\u", "count_", "(_", "self_", ",_", "contains_", ",_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\\u", "count_", "=_", "self_", "._", "renderer_", "._", "render", "ed", "\\u", "contents_", "._", "count_", "(_", "contains_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r", "\\u", "count_", "!=_", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "The", " ", "expected", " ", "content", "s", ":\\\\", "n", "%", "s", "\\\\", "n", ",", " ", "with", " ", "the", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "count", ":\\\\", "n", "%", "d", "\\\\", "nw", "ere", " ", "not", " ", "in", " ", "the", " ", "actual", " ", "render", "ed", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "content", "s", ":\\\\", "n", "%", "s", "\\\\", "nwi", "th", " ", "count", ":\\\\", "n", "%", "d", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "contains_", ",_", "count_", ",_", "self_", "._", "renderer_", "._", "render", "ed", "\\u", "contents_", ",_", "r", "\\u", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "AW", "SH", "elp", "Output", "Test_", "(_", "Base", "CLI", "Drive", "r", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "not", "\\u", "contains_", "(_", "self_", ",_", "contents_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contents_", "in_", "self_", "._", "renderer_", "._", "render", "ed", "\\u", "contents_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "The", " ", "content", "s", ":\\\\", "n", "%", "s", "\\\\", "nw", "ere", " ", "not", " ", "supp", "ose", " ", "to", " ", "be", " ", "in", " ", "the", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "actual", " ", "render", "ed", " ", "content", "s", ":\\\\", "n", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "contents_", ",_", "self_", "._", "renderer_", "._", "render", "ed", "\\u", "contents_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "AW", "SH", "elp", "Output", "Test_", "(_", "Base", "CLI", "Drive", "r", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "text", "\\u", "order_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "we", " ", "need", " ", "to", " ", "find", " ", "where", " ", "the", " ", "SYN", "OPS", "IS", " ", "section", " ", "starts", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "startin", "g", "\\u", "from_", "=_", "kwargs_", "._", "pop_", "(_", "'", "startin", "g", "\\u", "from", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "list_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "=_", "self_", "._", "renderer_", "._", "render", "ed", "\\u", "contents_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "startin", "g", "\\u", "from_", ",_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "index_", "=_", "contents_", "._", "find_", "(_", "startin", "g", "\\u", "from_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "\\u", "indices_", "=_", "[_", "contents_", "._", "find_", "(_", "arg_", ",_", "start", "\\u", "index_", ")_", "for_", "arg_", "in_", "args_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "previous_", "=_", "arg", "\\u", "indices_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "index_", "in_", "enumerate_", "(_", "arg", "\\u", "indices_", "[_", "1_", ":_", "]_", ",_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "index_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "The", " ", "string", " ", "%", "r", " ", "was", " ", "not", " ", "found", " ", "in", " ", "the", " ", "content", "s", ":", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "args_", "[_", "index_", "]_", ",_", "contents_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "index_", "<_", "previous_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "The", " ", "string", " ", "%", "r", " ", "came", " ", "bef", "ore", " ", "%", "r", ",", " ", "but", " ", "was", " ", "supp", "ose", " ", "to", " ", "come", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "after", " ", "it", ".\\\\", "n", "%", "s", "'_", "%_", "(_", "args_", "[_", "i_", "]_", ",_", "args_", "[_", "i_", "-_", "1_", "]_", ",_", "contents_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "previous_", "=_", "index_", "\\u\\u\\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_", "Captur", "ed", "Renderer_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Captur", "ed", "Renderer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "render", "ed", "\\u", "contents_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Captur", "ed", "Renderer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "contents_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "render", "ed", "\\u", "contents_", "=_", "contents_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\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_", "Captur", "ed", "Output_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Captur", "ed", "Output_", "(_", "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_", ",_", "stdout_", ",_", "stderr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stdout_", "=_", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stderr_", "=_", "stderr_", "\\u\\u\\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_", "@_", "contextlib_", "._", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "captur", "e\\u", "output_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stderr_", "=_", "six_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout_", "=_", "six_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "mock_", "._", "patch_", "(_", "'", "sys", ".", "std", "err", "'_", ",_", "stderr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "mock_", "._", "patch_", "(_", "'", "sys", ".", "stdout", "'_", ",_", "stdout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "Captur", "ed", "Output_", "(_", "stdout_", ",_", "stderr_", ")_", "\\u\\u\\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_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "Diff_", "=_", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "\\u", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "aws", "cli", "/\\u", "\\u", "init", "\\u\\u", ".", "py", " ", "inject", "s", " ", "AW", "S", "\\u", "DATA", "\\u", "PATH", " ", "at", " ", "import", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "tha", "t", " ", "we", " ", "can", " ", "find", " ", "cli", ".", "json", ".", " ", " ", "Thi", "s", " ", "mig", "ht", " ", "be", " ", "fixed", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "future", ",", " ", "but", " ", "for", " ", "now", " ", "we", " ", "just", " ", "gra", "b", " ", "tha", "t", " ", "value", " ", "out", " ", "of", " ", "the", " ", "real_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "os", ".", "environ", " ", "so", " ", "the", " ", "patche", "d", " ", "os", ".", "environ", " ", "has", " ", "this", " ", "data", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "CLI", " ", "works", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "environ_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AW", "S", "\\u", "DATA", "\\u", "PATH", "'_", ":_", "os_", "._", "environ_", "[_", "'", "AW", "S", "\\u", "DATA", "\\u", "PATH", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AW", "S", "\\u", "DEF", "AUL", "T", "\\u", "REGION", "'_", ":_", "'", "us", "-", "east", "-1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AW", "S", "\\u", "ACCESS", "\\u", "KEY", "\\u", "ID", "'_", ":_", "'", "access", "\\u", "key", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AW", "S", "\\u", "SEC", "RET", "\\u", "ACCESS", "\\u", "KEY", "'_", ":_", "'", "secret", "\\u", "key", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "environ", "\\u", "patch_", "=_", "mock_", "._", "patch_", "(_", "'", "os", ".", "environ", "'_", ",_", "self_", "._", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "environ", "\\u", "patch_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "http", "\\u", "response_", "=_", "requests_", "._", "models_", "._", "Response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "http", "\\u", "response_", "._", "status", "\\u", "code_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parsed", "\\u", "response_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "make", "\\u", "request", "\\u", "patch_", "=_", "mock_", "._", "patch_", "(_", "'", "botocore", ".", "endpoint", ".", "End", "point", ".", "make", "\\u", "request", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "make", "\\u", "request", "\\u", "is", "\\u", "patched_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "operati", "ons", "\\u", "called_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parsed", "\\u", "responses_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "=_", "create", "\\u", "cli", "driver_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", "(_", "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_", "#", " ", "Thi", "s", " ", "clear", "s", " ", "all", " ", "the", " ", "previ", "ous", " ", "registration", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "environ", "\\u", "patch_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "make", "\\u", "request", "\\u", "is", "\\u", "patched_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "make", "\\u", "request", "\\u", "patch_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "make", "\\u", "request", "\\u", "is", "\\u", "patched_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bef", "ore", "\\u", "call_", "(_", "self_", ",_", "params_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "store", "\\u", "params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "store", "\\u", "params_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "\\u", "request", "\\u", "dict_", "=_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "\\u", "params_", "=_", "params_", "[_", "'", "body", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "patch", "\\u", "make", "\\u", "request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "you", " ", "do", " ", "not", " ", "stop", " ", "a", " ", "previ", "ously", " ", "start", "ed", " ", "patch", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "can", " ", "neve", "r", " ", "be", " ", "stopp", "ed", " ", "if", " ", "you", " ", "call", " ", "start", "()", " ", "again", " ", "on", " ", "the", " ", "same_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "patch", " ", "again", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "stop", " ", "the", " ", "current", " ", "patch", " ", "bef", "ore", " ", "calling", " ", "start", "()", " ", "on", " ", "it", " ", "again", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "make", "\\u", "request", "\\u", "is", "\\u", "patched_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "make", "\\u", "request", "\\u", "patch_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "make", "\\u", "request", "\\u", "is", "\\u", "patched_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "make", "\\u", "request", "\\u", "patch_", "=_", "self_", "._", "make", "\\u", "request", "\\u", "patch_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "parsed", "\\u", "responses_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "make", "\\u", "request", "\\u", "patch_", "._", "side", "\\u", "effect_", "=_", "lambda_", "*_", "args_", ",_", "**_", "kwargs_", ":_", "(_", "self_", "._", "http", "\\u", "response_", ",_", "self_", "._", "parsed", "\\u", "responses_", "._", "pop_", "(_", "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 ", " _", "make", "\\u", "request", "\\u", "patch_", "._", "return", "\\u", "value_", "=_", "(_", "self_", "._", "http", "\\u", "response_", ",_", "self_", "._", "parsed", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "make", "\\u", "request", "\\u", "is", "\\u", "patched_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "params", "\\u", "for", "\\u", "cmd_", "(_", "self_", ",_", "cmd_", ",_", "params_", "=_", "None_", ",_", "expected", "\\u", "rc_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "std", "err", "\\u", "contains_", "=_", "None_", ",_", "ignore", "\\u", "params_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stdout_", ",_", "stderr_", ",_", "rc_", "=_", "self_", "._", "run", "\\u", "cmd_", "(_", "cmd_", ",_", "expected", "\\u", "rc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "std", "err", "\\u", "contains_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "In_", "(_", "std", "err", "\\u", "contains_", ",_", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "params_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "last", " ", "kwarg", "s", " ", "of", " ", "Opera", "tion", ".", "call", "()", " ", "in", " ", "botocore", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "kwargs_", "=_", "copy_", "._", "copy_", "(_", "self_", "._", "last", "\\u", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ignore", "\\u", "params_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "ignore", "\\u", "params_", ":_", "\\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 ", " ", " _", "del_", "last", "\\u", "kwargs_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "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_", "if_", "params_", "!=_", "last", "\\u", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Actual", " ", "params", " ", "did", " ", "not", " ", "match", " ", "expected", " ", "params", ".\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Expect", "ed", ":\\\\", "n", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Actual", ":\\\\", "n", "\\\\", "n", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pformat_", "(_", "params_", ")_", ",_", "pformat_", "(_", "last", "\\u", "kwargs_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "stdout_", ",_", "stderr_", ",_", "rc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bef", "ore", "\\u", "parameter", "\\u", "build_", "(_", "self_", ",_", "params_", ",_", "model_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "\\u", "kwargs_", "=_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "operati", "ons", "\\u", "called_", "._", "append_", "(_", "(_", "model_", ",_", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "cmd_", "(_", "self_", ",_", "cmd_", ",_", "expected", "\\u", "rc_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "\"", "Call", "ing", " ", "cmd", ":", " ", "%", "s", "\"_", ",_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "patch", "\\u", "make", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "session_", "._", "register_", "(_", "'", "bef", "ore", "-", "call", "'_", ",_", "self_", "._", "bef", "ore", "\\u", "call_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "session_", "._", "register_", "(_", "'", "bef", "ore", "-", "parameter", "-", "build", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bef", "ore", "\\u", "parameter", "\\u", "build_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "cmd_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmdli", "st_", "=_", "cmd_", "._", "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 ", " _", "cmdli", "st_", "=_", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "captur", "e\\u", "output_", "(_", ")_", "as_", "captured", "_", ":_", "\\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 ", " _", "rc_", "=_", "self_", "._", "driver_", "._", "main_", "(_", "cmdli", "st_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "System", "Exit_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "catch", " ", "System", "Exi", "t", " ", "so", " ", "tha", "t", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", " ", "get", " ", "a", " ", "proper", " ", "rc", " ", "and", " ", "still", " ", "presen", "t", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stdout", "/", "std", "err", " ", "to", " ", "the", " ", "test", " ", "runn", "er", " ", "so", " ", "we", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "figure", " ", "out", " ", "what", " ", "wen", "t", " ", "wrong", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rc_", "=_", "e_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stderr_", "=_", "captured", "_", "._", "stderr_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout_", "=_", "captured", "_", "._", "stdout_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "rc_", ",_", "expected", "\\u", "rc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Une", "xpe", "cte", "d", " ", "rc", " ", "(", "expected", ":", " ", "%", "s", ",", " ", "actual", ":", " ", "%", "s", ")", " ", "for", " ", "command", ":", " ", "%", "s", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stdout", ":\\\\", "n", "%", "sst", "der", "r", ":\\\\", "n", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "rc_", ",_", "rc_", ",_", "cmd_", ",_", "stdout_", ",_", "stderr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "stdout_", ",_", "stderr_", ",_", "rc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "AW", "SP", "review", "Command", "Param", "s", "Test_", "(_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "AW", "SP", "review", "Command", "Param", "s", "Test_", "(_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "previe", "w", "\\u", "patch_", "=_", "mock_", "._", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "aws", "cli", ".", "customization", "s", ".", "previe", "w", ".", "mark", "\\u", "as", "\\u", "previe", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "previe", "w", "\\u", "patch_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Base", "AW", "SP", "review", "Command", "Param", "s", "Test_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "AW", "SP", "review", "Command", "Param", "s", "Test_", "(_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "previe", "w", "\\u", "patch_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Base", "AW", "SP", "review", "Command", "Param", "s", "Test_", ",_", "self_", ")_", "._", "tear", "Down_", "(_", ")_", "\\u\\u\\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_", "File", "Creator_", "(_", "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_", "[SEP]_", "class_", "File", "Creator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rootdir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Creator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "all_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "self_", "._", "rootdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Creator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "file_", "(_", "self_", ",_", "filename_", ",_", "contents_", ",_", "mtime_", "=_", "None_", ",_", "mode_", "=_", "'", "w", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", "file", " ", "in", " ", "a", " ", "tmpdir", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "filename", "``", " ", "shou", "ld", " ", "be", " ", "a", " ", "relative", " ", "path", ",", " ", "e", ".", "g", ".", " ", "\"", "foo", "/", "bar", "/", "ba", "z", ".", "txt", "\"", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "will", " ", "be", " ", "translat", "ed", " ", "int", "o", " ", "a", " ", "full", " ", "path", " ", "in", " ", "a", " ", "tmp", " ", "dir", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "``", "mti", "me", "``", " ", "argu", "ment", " ", "is", " ", "provided", ",", " ", "then", " ", "the", " ", "file", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "mti", "me", " ", "will", " ", "be", " ", "set", " ", "to", " ", "the", " ", "provided", " ", "value", " ", "(", "must", " ", "be", " ", "an", " ", "epoch", " ", "time", ").", "\\", "10", ";", " ", " ", " ", " ", "Ot", "her", "wis", "e", " ", "the", " ", "mti", "me", " ", "is", " ", "left", " ", "unto", "uche", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "mode", "``", " ", "is", " ", "the", " ", "mode", " ", "the", " ", "file", " ", "shou", "ld", " ", "be", " ", "opene", "d", " ", "eit", "her", " ", "as", " ", "``", "w", "``", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "`", "wb", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "full", " ", "path", " ", "to", " ", "the", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "rootdir_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "full", "\\u", "path_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "full", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "full", "\\u", "path_", ",_", "mode_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "time_", "=_", "os_", "._", "path_", "._", "getmtime_", "(_", "full", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Subtract", " ", "a", " ", "few", " ", "year", "s", " ", "off", " ", "the", " ", "last", " ", "modification", " ", "date", "._", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "utime", "_", "(_", "full", "\\u", "path_", ",_", "(_", "current", "\\u", "time_", ",_", "current", "\\u", "time_", "-_", "100000000", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mtime_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "utime", "_", "(_", "full", "\\u", "path_", ",_", "(_", "mtime_", ",_", "mtime_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "full", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Creator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "append", "\\u", "file_", "(_", "self_", ",_", "filename_", ",_", "contents_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Append", " ", "content", "s", " ", "to", " ", "a", " ", "file", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "filename", "``", " ", "shou", "ld", " ", "be", " ", "a", " ", "relative", " ", "path", ",", " ", "e", ".", "g", ".", " ", "\"", "foo", "/", "bar", "/", "ba", "z", ".", "txt", "\"", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "will", " ", "be", " ", "translat", "ed", " ", "int", "o", " ", "a", " ", "full", " ", "path", " ", "in", " ", "a", " ", "tmp", " ", "dir", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "full", " ", "path", " ", "to", " ", "the", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "rootdir_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "full", "\\u", "path_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "full", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "full", "\\u", "path_", ",_", "'", "a", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "full", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Creator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "full", "\\u", "path_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Translate", " ", "relative", " ", "path", " ", "to", " ", "full", " ", "path", " ", "in", " ", "temp", " ", "dir", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "f", ".", "full", "\\u", "path", "('", "foo", "/", "bar", ".", "txt", "')", " ", "->", " ", "/", "tmp", "/", "asd", "fas", "d", "/", "foo", "/", "bar", ".", "txt", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "rootdir_", ",_", "filename_", ")_", "\\u\\u\\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_", "Process", "Terminate", "d", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Result_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Result_", "(_", "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_", ",_", "rc_", ",_", "stdout_", ",_", "stderr_", ",_", "memory", "\\u", "usage_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rc_", "=_", "rc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stdout_", "=_", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stderr_", "=_", "stderr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INTEG", "\\u", "LOG_", "._", "debug_", "(_", "\"", "rc", ":", " ", "%", "s", "\"_", ",_", "rc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INTEG", "\\u", "LOG_", "._", "debug_", "(_", "\"", "stdout", ":", " ", "%", "s", "\"_", ",_", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INTEG", "\\u", "LOG_", "._", "debug_", "(_", "\"", "std", "err", ":", " ", "%", "s", "\"_", ",_", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "memory", "\\u", "usage_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "memory", "\\u", "usage_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "memory", "\\u", "usage_", "=_", "memory", "\\u", "usage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result_", "(_", "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_", "def_", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json_", "._", "loads_", "(_", "self_", "._", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "escape", "\\u", "quotes_", "(_", "command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "windows", " ", "we", " ", "have", " ", "different", " ", "rule", "s", " ", "for", " ", "esca", "ping", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fi", "rst", ",", " ", "double", " ", "quote", "s", " ", "must", " ", "be", " ", "escaped", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "command_", "._", "replace_", "(_", "'\"'_", ",_", "'\\\\\\\\", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Second", ",", " ", "single", " ", "quote", "s", " ", "do", " ", "not", "hing", ",", " ", "to", " ", "quote", " ", "a", " ", "value", " ", "we", " ", "need", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", " ", "double", " ", "quote", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "command_", "._", "replace_", "(_", "\"'\"_", ",_", "'\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "command_", "\\u\\u\\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_", "aws_", "(_", "command_", ",_", "collect", "\\u", "memory_", "=_", "False_", ",_", "env", "\\u", "vars_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wait", "\\u", "for", "\\u", "finish_", "=_", "True_", ",_", "input", "\\u", "data_", "=_", "None_", ",_", "input", "\\u", "file_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "an", " ", "aws", " ", "command", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "help", " ", "function", " ", "abstract", "s", " ", "the", " ", "difference", "s", " ", "of", " ", "runn", "ing", " ", "the", " ", "\"", "aws", "\"", "\\", "10", ";", " ", " ", " ", " ", "command", " ", "on", " ", "different", " ", "platform", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "collect", "\\u", "memory", " ", "is", " ", "``", "Tru", "e", "``", " ", "the", " ", "the", " ", "Result", " ", "object", " ", "will", " ", "have", " ", "a", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "memory", " ", "usage", " ", "take", "n", " ", "at", " ", "2", " ", "second", " ", "interval", "s", ".", " ", " ", "The", " ", "memory", " ", "usage", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "be", " ", "in", " ", "bytes", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "env", "\\u", "vars", " ", "is", " ", "Non", "e", ",", " ", "this", " ", "will", " ", "set", " ", "the", " ", "environ", "ment", " ", "variab", "les", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "be", " ", "used", " ", "by", " ", "the", " ", "aws", " ", "process", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "wait", "\\u", "for", "\\u", "finish", " ", "is", " ", "Fal", "se", ",", " ", "then", " ", "the", " ", "Process", " ", "object", " ", "is", " ", "return", "ed", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "caller", ".", " ", " ", "It", " ", "is", " ", "then", " ", "the", " ", "caller", "'", "s", " ", "responsib", "ilit", "y", " ", "to", " ", "ensure", "\\", "10", ";", " ", " ", " ", " ", "proper", " ", "clean", "up", ".", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "usef", "ul", " ", "if", " ", "you", " ", "want", " ", "to", " ", "test", " ", "timeo", "ut", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "how", " ", "the", " ", "CLI", " ", "respond", "s", " ", "to", " ", "vari", "ous", " ", "signal", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "input", "\\u", "data", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "input", "\\u", "data", ":", " ", "Thi", "s", " ", "string", " ", "will", " ", "be", " ", "communi", "cated", " ", "to", " ", "the", " ", "process", " ", "through", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "std", "in", " ", "of", " ", "the", " ", "process", ".", " ", " ", "It", " ", "essential", "ly", " ", "allow", "s", " ", "the", " ", "user", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "avoid", " ", "hav", "ing", " ", "to", " ", "use", " ", "a", " ", "file", " ", "handle", " ", "to", " ", "pass", " ", "informati", "on", " ", "to", " ", "the", " ", "process", ".", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "this", " ", "string", " ", "is", " ", "not", " ", "pass", "ed", " ", "on", " ", "creati", "on", " ", "of", " ", "the", " ", "process", ",", " ", "but", "\\", "10", ";", " ", " ", " ", " ", "rat", "her", " ", "communi", "cated", " ", "to", " ", "the", " ", "process", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "input", "\\u", "file", ":", " ", "a", " ", "file", " ", "handle", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "input", "\\u", "file", ":", " ", "Thi", "s", " ", "is", " ", "a", " ", "file", " ", "handle", " ", "tha", "t", " ", "will", " ", "act", " ", "as", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "std", "in", " ", "of", " ", "the", " ", "process", " ", "immediate", "ly", " ", "on", " ", "creati", "on", ".", " ", " ", "Ess", "ential", "ly", "\\", "10", ";", " ", " ", " ", " ", "any", " ", "data", " ", "writt", "en", " ", "to", " ", "the", " ", "file", " ", "will", " ", "be", " ", "read", " ", "from", " ", "std", "in", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "process", ".", " ", "Thi", "s", " ", "is", " ", "need", "ed", " ", "if", " ", "you", " ", "plan", " ", "to", " ", "stream", " ", "data", " ", "int", "o", " ", "std", "in", " ", "whi", "le", "\\", "10", ";", " ", " ", " ", " ", "collecti", "ng", " ", "memory", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "platform_", "._", "system_", "(_", ")_", "==_", "'", "Window", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "\\u", "escape", "\\u", "quotes_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "AW", "S", "\\u", "TEST", "\\u", "COMMA", "ND", "'_", "in_", "os_", "._", "environ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aws", "\\u", "command_", "=_", "os_", "._", "environ_", "[_", "'", "AW", "S", "\\u", "TEST", "\\u", "COMMA", "ND", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aws", "\\u", "command_", "=_", "'", "python", " ", "%", "s", "'_", "%_", "get", "\\u", "aws", "\\u", "cmd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "full", "\\u", "command_", "=_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "aws", "\\u", "command_", ",_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout", "\\u", "encoding_", "=_", "get", "\\u", "stdout", "\\u", "encoding_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "full", "\\u", "command_", ",_", "six_", "._", "text", "\\u", "type_", ")_", "and_", "not_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full", "\\u", "command_", "=_", "full", "\\u", "command_", "._", "encode_", "(_", "stdout", "\\u", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "INTEG", "\\u", "LOG_", "._", "debug_", "(_", "\"", "Run", "ning", " ", "command", ":", " ", "%", "s", "\"_", ",_", "full", "\\u", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "os_", "._", "environ_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "[_", "'", "AW", "S", "\\u", "DEF", "AUL", "T", "\\u", "REGION", "'_", "]_", "=_", "\"", "us", "-", "east", "-1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "env", "\\u", "vars_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "=_", "env", "\\u", "vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "input", "\\u", "file_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "file_", "=_", "PIPE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "process_", "=_", "Popen_", "(_", "full", "\\u", "command_", ",_", "stdout_", "=_", "PIPE_", ",_", "stderr_", "=_", "PIPE_", ",_", "stdin_", "=_", "input", "\\u", "file_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shell_", "=_", "True_", ",_", "env_", "=_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "wait", "\\u", "for", "\\u", "finish_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "process_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "memory_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "collect", "\\u", "memory_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "input", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "{_", "'", "input", "'_", ":_", "input", "\\u", "data_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stdout_", ",_", "stderr_", "=_", "process_", "._", "communicate_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stdout_", ",_", "stderr_", ",_", "memory_", "=_", "\\u", "wait", "\\u", "and", "\\u", "collect", "\\u", "mem_", "(_", "process_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Result_", "(_", "process_", "._", "returncode_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "._", "decode_", "(_", "stdout", "\\u", "encoding_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "._", "decode_", "(_", "stdout", "\\u", "encoding_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory_", ")_", "\\u\\u\\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", "stdout", "\\u", "encoding_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encoding_", "=_", "getattr_", "(_", "sys_", "._", "\\u\\u", "stdout", "\\u\\u_", ",_", "'", "encoding", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "encoding_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encoding_", "=_", "'", "utf", "-", "8", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "encoding_", "\\u\\u\\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", "wait", "\\u", "and", "\\u", "collect", "\\u", "mem_", "(_", "process_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "only", " ", "know", " ", "how", " ", "to", " ", "collect", " ", "memory", " ", "on", " ", "mac", "/", "linux", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "platform_", "._", "system_", "(_", ")_", "==_", "'", "Dar", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "memory_", "=_", "\\u", "get", "\\u", "memory", "\\u", "with", "\\u", "ps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "platform_", "._", "system_", "(_", ")_", "==_", "'", "Lin", "ux", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "memory_", "=_", "\\u", "get", "\\u", "memory", "\\u", "with", "\\u", "ps_", "\\u\\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_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Can", "'", "t", " ", "collect", " ", "memory", " ", "for", " ", "process", " ", "on", " ", "platform", " ", "%", "s", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "platform_", "._", "system_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "memory_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "process_", "._", "poll_", "(_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current_", "=_", "get", "\\u", "memory_", "(_", "process_", "._", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Process", "Terminate", "d", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "possib", "le", " ", "the", " ", "process", " ", "terminate", "d", " ", "bet", "ween", " ", ".", "poll", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "get", "\\u", "memory", "()", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "memory_", "._", "append_", "(_", "current_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stdout_", ",_", "stderr_", "=_", "process_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "stdout_", ",_", "stderr_", ",_", "memory_", "\\u\\u\\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", "memory", "\\u", "with", "\\u", "ps_", "(_", "pid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "probab", "ly", " ", "possib", "le", " ", "to", " ", "do", " ", "with", " ", "proc", "\\u", "pid", "info", " ", "and", " ", "ctype", "s", " ", "on", " ", "a", " ", "Mac", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "we", "'", "ll", " ", "do", " ", "it", " ", "the", " ", "easy", " ", "way", " ", "with", " ", "pars", "ing", " ", "ps", " ", "output", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command", "\\u", "list_", "=_", "'", "ps", " ", "u", " ", "-", "p", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command", "\\u", "list_", "._", "append_", "(_", "str_", "(_", "pid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "Popen_", "(_", "command", "\\u", "list_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout_", "=_", "p_", "._", "communicate_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "p_", "._", "returncode_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Process", "Terminate", "d", "Error_", "(_", "str_", "(_", "pid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "RSS", " ", "from", " ", "output", " ", "tha", "t", " ", "look", "s", " ", "like", " ", "this", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "USER", " ", " ", " ", "PID", " ", " ", "%", "CPU", " ", "%", "MEM", " ", " ", "VS", "Z", " ", " ", " ", " ", "RSS", " ", " ", " ", "TT", " ", " ", "STAT", " ", "START", "ED", " ", " ", "TIME", " ", "COMMAND_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "user", " ", "471", "02", " ", " ", " ", "0.", "0", " ", " ", "0.", "1", " ", " ", "243", "7000", " ", " ", " ", "449", "6", " ", "s0", "02", " ", " ", "S", "+", " ", " ", " ", " ", "7", ":", "04", "PM", " ", " ", " ", "0", ":", "00", ".12", " ", "python", "2.6", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "stdout_", "._", "splitlines_", "(_", ")_", "[_", "1_", "]_", "._", "split_", "(_", ")_", "[_", "5_", "]_", ")_", "*_", "1024_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "class", " ", "for", " ", "aws", " ", "s3", " ", "command", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "contain", "s", " ", "convenien", "ce", " ", "function", "s", " ", "to", " ", "make", " ", "writ", "ing", " ", "these", " ", "tests", " ", "easi", "er", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "more", " ", "streamlin", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "files_", "=_", "File", "Creator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "=_", "botocore", "_", "._", "session_", "._", "get", "\\u", "session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "regions_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "region_", "=_", "'", "us", "-", "west", "-", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "=_", "self_", "._", "session_", "._", "create", "\\u", "client_", "(_", "'", "s3", "'_", ",_", "region", "\\u", "name_", "=_", "self_", "._", "region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "extra", "\\u", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extra", "\\u", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Subc", "lasse", "s", " ", "can", " ", "use", " ", "this", " ", "to", " ", "defin", "e", " ", "extra", " ", "setup", " ", "step", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "files_", "._", "remove", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "extra", "\\u", "teardown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extra", "\\u", "teardown_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Subc", "lasse", "s", " ", "can", " ", "use", " ", "this", " ", "to", " ", "defin", "e", " ", "extra", " ", "tear", "down", " ", "step", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "client", "\\u", "for", "\\u", "bucket_", "(_", "self_", ",_", "bucket", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "region_", "=_", "self_", "._", "regions_", "._", "get_", "(_", "bucket", "\\u", "name_", ",_", "self_", "._", "region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "session_", "._", "create", "\\u", "client_", "(_", "'", "s3", "'_", ",_", "region", "\\u", "name_", "=_", "region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "key", "\\u", "content", "s", "\\u", "equal_", "(_", "self_", ",_", "bucket_", ",_", "key_", ",_", "expected", "\\u", "contents_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "expected", "\\u", "contents_", ",_", "six_", "._", "Byte", "s", "IO_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "\\u", "contents_", "=_", "expected", "\\u", "contents_", "._", "getvalue_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "actual", "\\u", "contents_", "=_", "self_", "._", "get", "\\u", "key", "\\u", "contents_", "(_", "bucket_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "content", "s", " ", "can", " ", "be", " ", "huge", " ", "so", " ", "we", " ", "try", " ", "to", " ", "give", " ", "help", "ful", " ", "error", " ", "messages_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", "out", " ", "necessar", "il", "y", " ", "printin", "g", " ", "the", " ", "actual", " ", "content", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "actual", "\\u", "contents_", ")_", ",_", "len_", "(_", "expected", "\\u", "contents_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "actual", "\\u", "contents_", "!=_", "expected", "\\u", "contents_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Conten", "ts", " ", "for", " ", "%", "s", "/", "%", "s", " ", "do", " ", "not", " ", "match", " ", "(", "but", " ", "the", "y", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "have", " ", "the", " ", "same", " ", "length", ")\"_", "%_", "(_", "bucket_", ",_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "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_", "create", "\\u", "bucket_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "region_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "region_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "region_", "=_", "self_", "._", "region_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bucket", "\\u", "name_", "=_", "create", "\\u", "bucket_", "(_", "self_", "._", "session_", ",_", "name_", ",_", "region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "regions_", "[_", "bucket", "\\u", "name_", "]_", "=_", "region_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Cleanup_", "(_", "self_", "._", "delete", "\\u", "bucket_", ",_", "bucket", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "bucket", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put", "\\u", "object_", "(_", "self_", ",_", "bucket", "\\u", "name_", ",_", "key", "\\u", "name_", ",_", "contents_", "=_", "''_", ",_", "extra", "\\u", "args_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "self_", "._", "create", "\\u", "client", "\\u", "for", "\\u", "bucket_", "(_", "bucket", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "args_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Buck", "et", "'_", ":_", "bucket", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Key", "'_", ":_", "key", "\\u", "name_", ",_", "'", "Bod", "y", "'_", ":_", "contents_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "extra", "\\u", "args_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "call", "\\u", "args_", "._", "update_", "(_", "extra", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "client_", "._", "put", "\\u", "object_", "(_", "**_", "call", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Cleanup_", "(_", "self_", "._", "delete", "\\u", "key_", ",_", "bucket", "\\u", "name_", ",_", "key", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "bucket_", "(_", "self_", ",_", "bucket", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "remove", "\\u", "all", "\\u", "objects_", "(_", "bucket", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "create", "\\u", "client", "\\u", "for", "\\u", "bucket_", "(_", "bucket", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "delete", "\\u", "bucket_", "(_", "Bucket_", "=_", "bucket", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "regions_", "._", "pop_", "(_", "bucket", "\\u", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "all", "\\u", "objects_", "(_", "self_", ",_", "bucket", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "self_", "._", "create", "\\u", "client", "\\u", "for", "\\u", "bucket_", "(_", "bucket", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paginator_", "=_", "client_", "._", "get", "\\u", "paginator_", "(_", "'", "list", "\\u", "object", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pages_", "=_", "paginator_", "._", "paginate_", "(_", "Bucket_", "=_", "bucket", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "page_", "in_", "pages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "\\u", "names_", "+=_", "[_", "obj_", "[_", "'", "Key", "'_", "]_", "for_", "obj_", "in_", "page_", "._", "get_", "(_", "'", "Conten", "ts", "'_", ",_", "[_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key", "\\u", "name_", "in_", "key", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "delete", "\\u", "key_", "(_", "bucket", "\\u", "name_", ",_", "key", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "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_", "delete", "\\u", "key_", "(_", "self_", ",_", "bucket", "\\u", "name_", ",_", "key", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "self_", "._", "create", "\\u", "client", "\\u", "for", "\\u", "bucket_", "(_", "bucket", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "delete", "\\u", "object_", "(_", "Bucket_", "=_", "bucket", "\\u", "name_", ",_", "Key_", "=_", "key", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "key", "\\u", "contents_", "(_", "self_", ",_", "bucket", "\\u", "name_", ",_", "key", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "self_", "._", "create", "\\u", "client", "\\u", "for", "\\u", "bucket_", "(_", "bucket", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "get", "\\u", "object_", "(_", "Bucket_", "=_", "bucket", "\\u", "name_", ",_", "Key_", "=_", "key", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "[_", "'", "Bod", "y", "'_", "]_", "._", "read_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "key", "\\u", "exists_", "(_", "self_", ",_", "bucket", "\\u", "name_", ",_", "key", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "self_", "._", "create", "\\u", "client", "\\u", "for", "\\u", "bucket_", "(_", "bucket", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "._", "head", "\\u", "object_", "(_", "Bucket_", "=_", "bucket", "\\u", "name_", ",_", "Key_", "=_", "key", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Client", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "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_", "list", "\\u", "buckets_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "list", "\\u", "buckets_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "[_", "'", "Buck", "ets", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "content", "\\u", "type", "\\u", "for", "\\u", "key_", "(_", "self_", ",_", "bucket", "\\u", "name_", ",_", "key", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parsed_", "=_", "self_", "._", "head", "\\u", "object_", "(_", "bucket", "\\u", "name_", ",_", "key", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "parsed_", "[_", "'", "Conten", "t", "Type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "head", "\\u", "object_", "(_", "self_", ",_", "bucket", "\\u", "name_", ",_", "key", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "self_", "._", "create", "\\u", "client", "\\u", "for", "\\u", "bucket_", "(_", "bucket", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "head", "\\u", "object_", "(_", "Bucket_", "=_", "bucket", "\\u", "name_", ",_", "Key_", "=_", "key", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "S", "3", "CLI", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "\\u", "no", "\\u", "errors_", "(_", "self_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "rc_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Non", " ", "zero", " ", "rc", " ", "(%", "s", ")", " ", "receive", "d", ":", " ", "%", "s", "\"_", "%_", "(_", "p_", "._", "rc_", ",_", "p_", "._", "stdout_", "+_", "p_", "._", "stderr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "\"", "Error", ":\"_", ",_", "p_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "\"", "fail", "ed", ":\"_", ",_", "p_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "\"", "client", " ", "error", "\"_", ",_", "p_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "\"", "server", " ", "error", "\"_", ",_", "p_", "._", "stderr_", ")_", "\\u\\u\\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_", "String", "IO", "With", "File", "No_", "(_", "String", "IO_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "String", "IO", "With", "File", "No_", "(_", "String", "IO_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "fileno_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_" ]
[ 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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Incomplete ordering
evfredericksen/pynacea/pynhost/pynhost/grammarbase.py
[ { "content": "class GrammarBase:\n\n\n\n\n", "metadata": "root.GrammarBase", "header": "['module', '___EOS___']", "index": 2 }, { "content": " def __init__(self):\n self.mapping = {}\n self.app_context = ''\n self.settings = {\n 'filtered words': [],\n 'priority': 0,\n }\n self.context_filters = {}\n # no touchy\n self._rules = []\n self._recording_macros = {}", "metadata": "root.GrammarBase.__init__", "header": "['class', 'GrammarBase', ':', '___EOS___']", "index": 3 }, { "content": " def __lt__(self, other):\n return self.settings['priority'] < other.settings['priority']", "metadata": "root.GrammarBase.__lt__", "header": "['class', 'GrammarBase', ':', '___EOS___']", "index": 15 }, { "content": " def _change_global_context(self, context, value):\n self._handler.process_contexts[context] = value\n # recalculate active grammars\n self._handler.set_active_grammars()", "metadata": "root.GrammarBase._change_global_context", "header": "['class', 'GrammarBase', ':', '___EOS___']", "index": 18 }, { "content": " def _begin_recording_macro(self, rule_name):\n self._recording_macros[rule_name] = []", "metadata": "root.GrammarBase._begin_recording_macro", "header": "['class', 'GrammarBase', ':', '___EOS___']", "index": 23 }, { "content": " def _finish_recording_macros(self):\n new_rules = []\n for rule_name, macro in self._recording_macros.items():\n rule_name = '{} [<num>]'.format(rule_name)\n new_rules.append(ruleparser.Rule(rule_name, macro[:-1] + [dynamic.Num(-1).add(-1)], self))\n for rule in self._rules:\n if rule.pattern_text not in [r.pattern_text for r in new_rules]:\n new_rules.append(rule)\n self._rules = new_rules\n self._recording_macros = {}", "metadata": "root.GrammarBase._finish_recording_macros", "header": "['class', 'GrammarBase', ':', '___EOS___']", "index": 26 }, { "content": " def _set_rules(self):\n for rule_text, actions in self.mapping.items():\n rule = ruleparser.Rule(rule_text, actions, self)\n self._rules.append(rule)", "metadata": "root.GrammarBase._set_rules", "header": "['class', 'GrammarBase', ':', '___EOS___']", "index": 37 } ]
[ { "span": "class GrammarBase:", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 18 } ]
[ { "span": "def __lt__(self, other):", "start_line": 15, "start_column": 4, "end_line": 15, "end_column": 28 } ]
1
false
[ "[CLS]_", "Incomp", "lete", "_", "ordering_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Gram", "mar", "Base_", ":_", "\\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_", "[SEP]_", "class_", "Gram", "mar", "Base_", ":_", "\\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_", "._", "mapping_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app", "\\u", "context_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "settings_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filter", "ed", " ", "words", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "priorit", "y", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "context", "\\u", "filters_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "touch", "y_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "rules_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "record", "ing", "\\u", "macros_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gram", "mar", "Base_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "settings_", "[_", "'", "priorit", "y", "'_", "]_", "<_", "other_", "._", "settings_", "[_", "'", "priorit", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gram", "mar", "Base_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "change", "\\u", "global", "\\u", "context_", "(_", "self_", ",_", "context_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "handler_", "._", "process", "\\u", "contexts_", "[_", "context_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "recalc", "ulate", " ", "active", " ", "grammar", "s_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "handler_", "._", "set\\u", "active", "\\u", "grammar", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gram", "mar", "Base_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "begin", "\\u", "record", "ing", "\\u", "macro_", "(_", "self_", ",_", "rule", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "record", "ing", "\\u", "macros_", "[_", "rule", "\\u", "name_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gram", "mar", "Base_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "finish", "\\u", "record", "ing", "\\u", "macros_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "rules_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rule", "\\u", "name_", ",_", "macro_", "in_", "self_", "._", "\\u", "record", "ing", "\\u", "macros_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule", "\\u", "name_", "=_", "'{}", " ", "[", "<", "num", ">]", "'_", "._", "format_", "(_", "rule", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "rules_", "._", "append_", "(_", "rule", "parser_", "._", "Rule_", "(_", "rule", "\\u", "name_", ",_", "macro_", "[_", ":_", "-_", "1_", "]_", "+_", "[_", "dynamic_", "._", "Num_", "(_", "-_", "1_", ")_", "._", "add_", "(_", "-_", "1_", ")_", "]_", ",_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "rule_", "in_", "self_", "._", "\\u", "rules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "rule_", "._", "pattern", "\\u", "text_", "not_", "in_", "[_", "r_", "._", "pattern", "\\u", "text_", "for_", "r_", "in_", "new", "\\u", "rules_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "rules_", "._", "append_", "(_", "rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "rules_", "=_", "new", "\\u", "rules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "record", "ing", "\\u", "macros_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gram", "mar", "Base_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "rules_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "rule", "\\u", "text_", ",_", "actions_", "in_", "self_", "._", "mapping_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "rule", "\\u", "text_", ",_", "actions_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
Microsoft/ivy/src/ivy/ivy_transrel.py
[ { "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 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 } ]
[ { "span": "ac ", "start_line": 416, "start_column": 8, "end_line": 416, "end_column": 10 }, { "span": "used_syms ", "start_line": 473, "start_column": 4, "end_line": 473, "end_column": 13 } ]
[]
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_", "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_", "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_" ]
[ 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,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)\n j_fun = lambda x: -np.pi*np.sin(np.pi*x)\n q_fun = lambda x: -(np.pi**2)*np.cos(np.pi*x)\n\n xc_ana = phi(self.M.gridCC)\n q_ana = q_fun(self.M.gridCC)\n j_ana = j_fun(self.M.gridFx)\n\n #TODO: Check where our boundary conditions are CCx or Nx\n # vec = self.M.vectorNx\n vec = self.M.vectorCCx\n\n phi_bc = phi(vec[[0,-1]])\n j_bc = j_fun(vec[[0,-1]])\n\n P, Pin, Pout = self.M.getBCProjWF([['dirichlet', 'dirichlet']])\n\n Mc = self.M.getFaceInnerProduct()\n McI = Utils.sdInv(self.M.getFaceInnerProduct())\n V = Utils.sdiag(self.M.vol)\n G = -Pin.T*Pin*self.M.faceDiv.T * V\n D = self.M.faceDiv\n j = McI*(G*xc_ana + P*phi_bc)\n q = V*D*Pin.T*Pin*j + V*D*Pout.T*j_bc\n\n # Rearrange if we know q to solve for x\n A = V*D*Pin.T*Pin*McI*G\n rhs = V*q_ana - V*D*Pin.T*Pin*McI*P*phi_bc - V*D*Pout.T*j_bc\n # A = D*McI*G\n # rhs = q_ana - D*McI*P*phi_bc\n\n\n if self.myTest == 'j':\n err = np.linalg.norm((j-j_ana), np.inf)\n elif self.myTest == 'q':\n err = np.linalg.norm((q-V*q_ana), np.inf)\n elif self.myTest == 'xc':\n #TODO: fix the null space\n solver = SolverCG(A, maxiter=1000)\n xc = solver * (rhs)\n print 'ACCURACY', np.linalg.norm(Utils.mkvc(A*xc) - rhs)\n err = np.linalg.norm((xc-xc_ana), np.inf)\n elif self.myTest == 'xcJ':\n #TODO: fix the null space\n xc = Solver(A) * (rhs)\n print np.linalg.norm(Utils.mkvc(A*xc) - rhs)\n j = McI*(G*xc + P*phi_bc)\n err = np.linalg.norm((j-j_ana), np.inf)\n\n return err", "metadata": "root.Test1D_InhomogeneousDirichlet.getError", "header": "['class', 'Test1D_InhomogeneousDirichlet', '(', 'Tests', '.', 'OrderTest', ')', ':', '___EOS___']", "index": 15 }, { "content": " def getError(self):\n #Test function\n phi = lambda x: np.cos(np.pi*x[:,0])*np.cos(np.pi*x[:,1])\n j_funX = lambda x: -np.pi*np.sin(np.pi*x[:,0])*np.cos(np.pi*x[:,1])\n j_funY = lambda x: -np.pi*np.cos(np.pi*x[:,0])*np.sin(np.pi*x[:,1])\n q_fun = lambda x: -2*(np.pi**2)*phi(x)\n\n xc_ana = phi(self.M.gridCC)\n q_ana = q_fun(self.M.gridCC)\n jX_ana = j_funX(self.M.gridFx)\n jY_ana = j_funY(self.M.gridFy)\n j_ana = np.r_[jX_ana,jY_ana]\n\n #TODO: Check where our boundary conditions are CCx or Nx\n # fxm,fxp,fym,fyp = self.M.faceBoundaryInd\n # gBFx = self.M.gridFx[(fxm|fxp),:]\n # gBFy = self.M.gridFy[(fym|fyp),:]\n fxm,fxp,fym,fyp = self.M.cellBoundaryInd\n gBFx = self.M.gridCC[(fxm|fxp),:]\n gBFy = self.M.gridCC[(fym|fyp),:]\n\n bc = phi(np.r_[gBFx,gBFy])\n\n # P = sp.csr_matrix(([-1,1],([0,self.M.nF-1],[0,1])), shape=(self.M.nF, 2))\n\n P, Pin, Pout = self.M.getBCProjWF('dirichlet')\n\n Mc = self.M.getFaceInnerProduct()\n McI = Utils.sdInv(self.M.getFaceInnerProduct())\n G = -self.M.faceDiv.T * Utils.sdiag(self.M.vol)\n D = self.M.faceDiv\n j = McI*(G*xc_ana + P*bc)\n q = D*j\n\n # self.M.plotImage(j, 'FxFy', showIt=True)\n\n # Rearrange if we know q to solve for x\n A = D*McI*G\n rhs = q_ana - D*McI*P*bc\n\n if self.myTest == 'j':\n err = np.linalg.norm((j-j_ana), np.inf)\n elif self.myTest == 'q':\n err = np.linalg.norm((q-q_ana), np.inf)\n elif self.myTest == 'xc':\n xc = Solver(A) * (rhs)\n err = np.linalg.norm((xc-xc_ana), np.inf)\n elif self.myTest == 'xcJ':\n xc = Solver(A) * (rhs)\n j = McI*(G*xc + P*bc)\n err = np.linalg.norm((j-j_ana), np.inf)\n\n return err", "metadata": "root.Test2D_InhomogeneousDirichlet.getError", "header": "['class', 'Test2D_InhomogeneousDirichlet', '(', 'Tests', '.', 'OrderTest', ')', ':', '___EOS___']", "index": 96 }, { "content": " def getError(self):\n #Test function\n phi = lambda x: np.sin(np.pi*x)\n j_fun = lambda x: np.pi*np.cos(np.pi*x)\n q_fun = lambda x: -(np.pi**2)*np.sin(np.pi*x)\n\n xc_ana = phi(self.M.gridCC)\n q_ana = q_fun(self.M.gridCC)\n j_ana = j_fun(self.M.gridFx)\n\n #TODO: Check where our boundary conditions are CCx or Nx\n vecN = self.M.vectorNx\n vecC = self.M.vectorCCx\n\n phi_bc = phi(vecC[[0,-1]])\n j_bc = j_fun(vecN[[0,-1]])\n\n P, Pin, Pout = self.M.getBCProjWF([['neumann', 'neumann']])\n\n Mc = self.M.getFaceInnerProduct()\n McI = Utils.sdInv(self.M.getFaceInnerProduct())\n V = Utils.sdiag(self.M.vol)\n G = -Pin.T*Pin*self.M.faceDiv.T * V\n D = self.M.faceDiv\n j = McI*(G*xc_ana + P*phi_bc)\n q = V*D*Pin.T*Pin*j + V*D*Pout.T*j_bc\n\n # Rearrange if we know q to solve for x\n A = V*D*Pin.T*Pin*McI*G\n rhs = V*q_ana - V*D*Pin.T*Pin*McI*P*phi_bc - V*D*Pout.T*j_bc\n # A = D*McI*G\n # rhs = q_ana - D*McI*P*phi_bc\n\n\n if self.myTest == 'j':\n err = np.linalg.norm((Pin*j-Pin*j_ana), np.inf)\n elif self.myTest == 'q':\n err = np.linalg.norm((q-V*q_ana), np.inf)\n elif self.myTest == 'xc':\n #TODO: fix the null space\n xc, info = sp.linalg.minres(A, rhs, tol = 1e-6)\n err = np.linalg.norm((xc-xc_ana), np.inf)\n if info > 0:\n print 'Solve does not work well'\n print 'ACCURACY', np.linalg.norm(Utils.mkvc(A*xc) - rhs)\n elif self.myTest == 'xcJ':\n #TODO: fix the null space\n xc, info = sp.linalg.minres(A, rhs, tol = 1e-6)\n j = McI*(G*xc + P*phi_bc)\n err = np.linalg.norm((Pin*j-Pin*j_ana), np.inf)\n if info > 0:\n print 'Solve does not work well'\n print 'ACCURACY', np.linalg.norm(Utils.mkvc(A*xc) - rhs)\n return err", "metadata": "root.Test1D_InhomogeneousNeumann.getError", "header": "['class', 'Test1D_InhomogeneousNeumann', '(', 'Tests', '.', 'OrderTest', ')', ':', '___EOS___']", "index": 177 }, { "content": " def getError(self):\n #Test function\n phi = lambda x: np.sin(np.pi*x[:,0])*np.sin(np.pi*x[:,1])\n j_funX = lambda x: np.pi*np.cos(np.pi*x[:,0])*np.sin(np.pi*x[:,1])\n j_funY = lambda x: np.pi*np.sin(np.pi*x[:,0])*np.cos(np.pi*x[:,1])\n q_fun = lambda x: -2*(np.pi**2)*phi(x)\n\n xc_ana = phi(self.M.gridCC)\n q_ana = q_fun(self.M.gridCC)\n jX_ana = j_funX(self.M.gridFx)\n jY_ana = j_funY(self.M.gridFy)\n j_ana = np.r_[jX_ana,jY_ana]\n\n #TODO: Check where our boundary conditions are CCx or Nx\n\n cxm,cxp,cym,cyp = self.M.cellBoundaryInd\n fxm,fxp,fym,fyp = self.M.faceBoundaryInd\n\n gBFx = self.M.gridFx[(fxm|fxp),:]\n gBFy = self.M.gridFy[(fym|fyp),:]\n\n gBCx = self.M.gridCC[(cxm|cxp),:]\n gBCy = self.M.gridCC[(cym|cyp),:]\n\n phi_bc = phi(np.r_[gBFx,gBFy])\n j_bc = np.r_[j_funX(gBFx), j_funY(gBFy)]\n\n # P = sp.csr_matrix(([-1,1],([0,self.M.nF-1],[0,1])), shape=(self.M.nF, 2))\n\n P, Pin, Pout = self.M.getBCProjWF('neumann')\n\n Mc = self.M.getFaceInnerProduct()\n McI = Utils.sdInv(self.M.getFaceInnerProduct())\n V = Utils.sdiag(self.M.vol)\n G = -Pin.T*Pin*self.M.faceDiv.T * V\n D = self.M.faceDiv\n j = McI*(G*xc_ana + P*phi_bc)\n q = V*D*Pin.T*Pin*j + V*D*Pout.T*j_bc\n\n # Rearrange if we know q to solve for x\n A = V*D*Pin.T*Pin*McI*G\n rhs = V*q_ana - V*D*Pin.T*Pin*McI*P*phi_bc - V*D*Pout.T*j_bc\n\n if self.myTest == 'j':\n err = np.linalg.norm((Pin*j-Pin*j_ana), np.inf)\n elif self.myTest == 'q':\n err = np.linalg.norm((q-V*q_ana), np.inf)\n elif self.myTest == 'xc':\n #TODO: fix the null space\n xc, info = sp.linalg.minres(A, rhs, tol = 1e-6)\n err = np.linalg.norm((xc-xc_ana), np.inf)\n if info > 0:\n print 'Solve does not work well'\n print 'ACCURACY', np.linalg.norm(Utils.mkvc(A*xc) - rhs)\n elif self.myTest == 'xcJ':\n #TODO: fix the null space\n xc, info = sp.linalg.minres(A, rhs, tol = 1e-6)\n j = McI*(G*xc + P*phi_bc)\n err = np.linalg.norm((Pin*j-Pin*j_ana), np.inf)\n if info > 0:\n print 'Solve does not work well'\n print 'ACCURACY', np.linalg.norm(Utils.mkvc(A*xc) - rhs)\n return err", "metadata": "root.Test2D_InhomogeneousNeumann.getError", "header": "['class', 'Test2D_InhomogeneousNeumann', '(', 'Tests', '.', 'OrderTest', ')', ':', '___EOS___']", "index": 255 }, { "content": " def getError(self):\n #Test function\n phi = lambda x: np.cos(0.5*np.pi*x)\n j_fun = lambda x: -0.5*np.pi*np.sin(0.5*np.pi*x)\n q_fun = lambda x: -0.25*(np.pi**2)*np.cos(0.5*np.pi*x)\n\n xc_ana = phi(self.M.gridCC)\n q_ana = q_fun(self.M.gridCC)\n j_ana = j_fun(self.M.gridFx)\n\n #TODO: Check where our boundary conditions are CCx or Nx\n vecN = self.M.vectorNx\n vecC = self.M.vectorCCx\n\n phi_bc = phi(vecC[[0,-1]])\n j_bc = j_fun(vecN[[0,-1]])\n\n P, Pin, Pout = self.M.getBCProjWF([['dirichlet', 'neumann']])\n\n Mc = self.M.getFaceInnerProduct()\n McI = Utils.sdInv(self.M.getFaceInnerProduct())\n V = Utils.sdiag(self.M.vol)\n G = -Pin.T*Pin*self.M.faceDiv.T * V\n D = self.M.faceDiv\n j = McI*(G*xc_ana + P*phi_bc)\n q = V*D*Pin.T*Pin*j + V*D*Pout.T*j_bc\n\n # Rearrange if we know q to solve for x\n A = V*D*Pin.T*Pin*McI*G\n rhs = V*q_ana - V*D*Pin.T*Pin*McI*P*phi_bc - V*D*Pout.T*j_bc\n # A = D*McI*G\n # rhs = q_ana - D*McI*P*phi_bc\n\n\n if self.myTest == 'j':\n err = np.linalg.norm((Pin*j-Pin*j_ana), np.inf)\n elif self.myTest == 'q':\n err = np.linalg.norm((q-V*q_ana), np.inf)\n elif self.myTest == 'xc':\n #TODO: fix the null space\n xc, info = sp.linalg.minres(A, rhs, tol = 1e-6)\n err = np.linalg.norm((xc-xc_ana), np.inf)\n if info > 0:\n print 'Solve does not work well'\n print 'ACCURACY', np.linalg.norm(Utils.mkvc(A*xc) - rhs)\n elif self.myTest == 'xcJ':\n #TODO: fix the null space\n xc, info = sp.linalg.minres(A, rhs, tol = 1e-6)\n j = McI*(G*xc + P*phi_bc)\n err = np.linalg.norm((Pin*j-Pin*j_ana), np.inf)\n if info > 0:\n print 'Solve does not work well'\n print 'ACCURACY', np.linalg.norm(Utils.mkvc(A*xc) - rhs)\n return err", "metadata": "root.Test1D_InhomogeneousMixed.getError", "header": "['class', 'Test1D_InhomogeneousMixed', '(', 'Tests', '.', 'OrderTest', ')', ':', '___EOS___']", "index": 341 }, { "content": " def getError(self):\n #Test function\n phi = lambda x: np.cos(0.5*np.pi*x[:,0])*np.cos(0.5*np.pi*x[:,1])\n j_funX = lambda x: -0.5*np.pi*np.sin(0.5*np.pi*x[:,0])*np.cos(0.5*np.pi*x[:,1])\n j_funY = lambda x: -0.5*np.pi*np.cos(0.5*np.pi*x[:,0])*np.sin(0.5*np.pi*x[:,1])\n q_fun = lambda x: -2*((0.5*np.pi)**2)*phi(x)\n\n xc_ana = phi(self.M.gridCC)\n q_ana = q_fun(self.M.gridCC)\n jX_ana = j_funX(self.M.gridFx)\n jY_ana = j_funY(self.M.gridFy)\n j_ana = np.r_[jX_ana,jY_ana]\n\n #TODO: Check where our boundary conditions are CCx or Nx\n\n cxm,cxp,cym,cyp = self.M.cellBoundaryInd\n fxm,fxp,fym,fyp = self.M.faceBoundaryInd\n\n gBFx = self.M.gridFx[(fxm|fxp),:]\n gBFy = self.M.gridFy[(fym|fyp),:]\n\n gBCx = self.M.gridCC[(cxm|cxp),:]\n gBCy = self.M.gridCC[(cym|cyp),:]\n\n phi_bc = phi(np.r_[gBCx,gBCy])\n j_bc = np.r_[j_funX(gBFx), j_funY(gBFy)]\n\n # P = sp.csr_matrix(([-1,1],([0,self.M.nF-1],[0,1])), shape=(self.M.nF, 2))\n\n P, Pin, Pout = self.M.getBCProjWF([['dirichlet', 'neumann'], ['dirichlet', 'neumann']])\n\n Mc = self.M.getFaceInnerProduct()\n McI = Utils.sdInv(self.M.getFaceInnerProduct())\n V = Utils.sdiag(self.M.vol)\n G = -Pin.T*Pin*self.M.faceDiv.T * V\n D = self.M.faceDiv\n j = McI*(G*xc_ana + P*phi_bc)\n q = V*D*Pin.T*Pin*j + V*D*Pout.T*j_bc\n\n # Rearrange if we know q to solve for x\n A = V*D*Pin.T*Pin*McI*G\n rhs = V*q_ana - V*D*Pin.T*Pin*McI*P*phi_bc - V*D*Pout.T*j_bc\n\n if self.myTest == 'j':\n err = np.linalg.norm((Pin*j-Pin*j_ana), np.inf)\n elif self.myTest == 'q':\n err = np.linalg.norm((q-V*q_ana), np.inf)\n elif self.myTest == 'xc':\n #TODO: fix the null space\n xc, info = sp.linalg.minres(A, rhs, tol = 1e-6)\n err = np.linalg.norm((xc-xc_ana), np.inf)\n if info > 0:\n print 'Solve does not work well'\n print 'ACCURACY', np.linalg.norm(Utils.mkvc(A*xc) - rhs)\n elif self.myTest == 'xcJ':\n #TODO: fix the null space\n xc, info = sp.linalg.minres(A, rhs, tol = 1e-6)\n j = McI*(G*xc + P*phi_bc)\n err = np.linalg.norm((Pin*j-Pin*j_ana), np.inf)\n if info > 0:\n print 'Solve does not work well'\n print 'ACCURACY', np.linalg.norm(Utils.mkvc(A*xc) - rhs)\n return err", "metadata": "root.Test2D_InhomogeneousMixed.getError", "header": "['class', 'Test2D_InhomogeneousMixed', '(', 'Tests', '.', 'OrderTest', ')', ':', '___EOS___']", "index": 419 } ]
[ { "span": "Mc ", "start_line": 34, "start_column": 8, "end_line": 34, "end_column": 10 }, { "span": "Mc ", "start_line": 123, "start_column": 8, "end_line": 123, "end_column": 10 }, { "span": "Mc ", "start_line": 196, "start_column": 8, "end_line": 196, "end_column": 10 }, { "span": "gBCx ", "start_line": 276, "start_column": 8, "end_line": 276, "end_column": 12 }, { "span": "gBCy ", "start_line": 277, "start_column": 8, "end_line": 277, "end_column": 12 }, { "span": "Mc ", "start_line": 286, "start_column": 8, "end_line": 286, "end_column": 10 }, { "span": "Mc ", "start_line": 360, "start_column": 8, "end_line": 360, "end_column": 10 }, { "span": "Mc ", "start_line": 450, "start_column": 8, "end_line": 450, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "1", "D", "\\u", "In", "homogene", "ous", "Dir", "ich", "let_", "(_", "Tests_", "._", "Order", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Test", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phi_", "=_", "lambda_", "x_", ":_", "np_", "._", "cos_", "(_", "np_", "._", "pi_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "fun_", "=_", "lambda_", "x_", ":_", "-_", "np_", "._", "pi_", "*_", "np_", "._", "sin_", "(_", "np_", "._", "pi_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "fun_", "=_", "lambda_", "x_", ":_", "-_", "(_", "np_", "._", "pi_", "**_", "2_", ")_", "*_", "np_", "._", "cos_", "(_", "np_", "._", "pi_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xc", "\\u", "ana", "_", "=_", "phi_", "(_", "self_", "._", "M_", "._", "grid", "CC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "ana", "_", "=_", "q", "\\u", "fun_", "(_", "self_", "._", "M_", "._", "grid", "CC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "ana", "_", "=_", "j", "\\u", "fun_", "(_", "self_", "._", "M_", "._", "grid", "Fx", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", ":", " ", "Check", " ", "where", " ", "our", " ", "bound", "ary", " ", "condition", "s", " ", "are", " ", "CC", "x", " ", "or", " ", "Nx", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vec", " ", "=", " ", "self", ".", "M", ".", "vector", "Nx", "_", "\\u\\u\\uNL\\u\\u\\u_", "vec_", "=_", "self_", "._", "M_", "._", "vector", "CC", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "phi", "\\u", "bc_", "=_", "phi_", "(_", "vec_", "[_", "[_", "0_", ",_", "-_", "1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "bc_", "=_", "j", "\\u", "fun_", "(_", "vec_", "[_", "[_", "0_", ",_", "-_", "1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", ",_", "Pin_", ",_", "Pou", "t_", "=_", "self_", "._", "M_", "._", "get", "BC", "Proj", "WF", "_", "(_", "[_", "[_", "'", "diri", "chl", "et", "'_", ",_", "'", "diri", "chl", "et", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Mc", "_", "=_", "self_", "._", "M_", "._", "get", "Face", "In", "ner", "Product_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mc", "I_", "=_", "Utils_", "._", "sd", "Inv", "_", "(_", "self_", "._", "M_", "._", "get", "Face", "In", "ner", "Product_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "V_", "=_", "Utils_", "._", "sdi", "ag_", "(_", "self_", "._", "M_", "._", "vol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "=_", "-_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "self_", "._", "M_", "._", "face", "Div_", "._", "T_", "*_", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "D_", "=_", "self_", "._", "M_", "._", "face", "Div_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "Mc", "I_", "*_", "(_", "G_", "*_", "xc", "\\u", "ana", "_", "+_", "P_", "*_", "phi", "\\u", "bc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "V_", "*_", "D_", "*_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "j_", "+_", "V_", "*_", "D_", "*_", "Pou", "t_", "._", "T_", "*_", "j", "\\u", "bc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rea", "rra", "nge", " ", "if", " ", "we", " ", "know", " ", "q", " ", "to", " ", "solve", " ", "for", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "V_", "*_", "D_", "*_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "Mc", "I_", "*_", "G_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rhs_", "=_", "V_", "*_", "q", "\\u", "ana", "_", "-_", "V_", "*_", "D_", "*_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "Mc", "I_", "*_", "P_", "*_", "phi", "\\u", "bc_", "-_", "V_", "*_", "D_", "*_", "Pou", "t_", "._", "T_", "*_", "j", "\\u", "bc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "=", " ", "D", "*", "Mc", "I", "*", "G_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rhs", " ", "=", " ", "q", "\\u", "ana", " ", "-", " ", "D", "*", "Mc", "I", "*", "P", "*", "phi", "\\u", "bc_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "my", "Test_", "==_", "'", "j", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "j_", "-_", "j", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "q", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "q_", "-_", "V_", "*_", "q", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "xc", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "fix", " ", "the", " ", "null", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "solver_", "=_", "Solve", "r", "CG", "_", "(_", "A_", ",_", "maxiter_", "=_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xc_", "=_", "solver_", "*_", "(_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "ACC", "URA", "CY", "'_", ",_", "np_", "._", "linalg_", "._", "norm_", "(_", "Utils_", "._", "mkv", "c_", "(_", "A_", "*_", "xc_", ")_", "-_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "xc_", "-_", "xc", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "xc", "J", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "fix", " ", "the", " ", "null", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xc_", "=_", "Solver_", "(_", "A_", ")_", "*_", "(_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "np_", "._", "linalg_", "._", "norm_", "(_", "Utils_", "._", "mkv", "c_", "(_", "A_", "*_", "xc_", ")_", "-_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "Mc", "I_", "*_", "(_", "G_", "*_", "xc_", "+_", "P_", "*_", "phi", "\\u", "bc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "j_", "-_", "j", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "err_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "2", "D", "\\u", "In", "homogene", "ous", "Dir", "ich", "let_", "(_", "Tests_", "._", "Order", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Test", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phi_", "=_", "lambda_", "x_", ":_", "np_", "._", "cos_", "(_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "0_", "]_", ")_", "*_", "np_", "._", "cos_", "(_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "fun", "X_", "=_", "lambda_", "x_", ":_", "-_", "np_", "._", "pi_", "*_", "np_", "._", "sin_", "(_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "0_", "]_", ")_", "*_", "np_", "._", "cos_", "(_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "fun", "Y_", "=_", "lambda_", "x_", ":_", "-_", "np_", "._", "pi_", "*_", "np_", "._", "cos_", "(_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "0_", "]_", ")_", "*_", "np_", "._", "sin_", "(_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "fun_", "=_", "lambda_", "x_", ":_", "-_", "2_", "*_", "(_", "np_", "._", "pi_", "**_", "2_", ")_", "*_", "phi_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xc", "\\u", "ana", "_", "=_", "phi_", "(_", "self_", "._", "M_", "._", "grid", "CC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "ana", "_", "=_", "q", "\\u", "fun_", "(_", "self_", "._", "M_", "._", "grid", "CC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "X", "\\u", "ana", "_", "=_", "j", "\\u", "fun", "X_", "(_", "self_", "._", "M_", "._", "grid", "Fx", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "Y", "\\u", "ana", "_", "=_", "j", "\\u", "fun", "Y_", "(_", "self_", "._", "M_", "._", "grid", "Fy", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "ana", "_", "=_", "np_", "._", "r\\u_", "[_", "j", "X", "\\u", "ana", "_", ",_", "j", "Y", "\\u", "ana", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", ":", " ", "Check", " ", "where", " ", "our", " ", "bound", "ary", " ", "condition", "s", " ", "are", " ", "CC", "x", " ", "or", " ", "Nx", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fx", "m", ",", "fx", "p", ",", "fy", "m", ",", "fy", "p", " ", "=", " ", "self", ".", "M", ".", "face", "Boundar", "y", "Ind_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "g", "BF", "x", " ", "=", " ", "self", ".", "M", ".", "grid", "Fx", "[(", "fx", "m", "|", "fx", "p", "),", ":]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "g", "BF", "y", " ", "=", " ", "self", ".", "M", ".", "grid", "Fy", "[(", "fy", "m", "|", "fy", "p", "),", ":]", "_", "\\u\\u\\uNL\\u\\u\\u_", "fx", "m_", ",_", "fx", "p_", ",_", "fy", "m_", ",_", "fy", "p_", "=_", "self_", "._", "M_", "._", "cell", "Boundar", "y", "Ind_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "BF", "x_", "=_", "self_", "._", "M_", "._", "grid", "CC_", "[_", "(_", "fx", "m_", "|_", "fx", "p_", ")_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "BF", "y_", "=_", "self_", "._", "M_", "._", "grid", "CC_", "[_", "(_", "fy", "m_", "|_", "fy", "p_", ")_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bc_", "=_", "phi_", "(_", "np_", "._", "r\\u_", "[_", "g", "BF", "x_", ",_", "g", "BF", "y_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "P", " ", "=", " ", "sp", ".", "csr", "\\u", "matrix", "(([", "-1", ",", "1", "],", "([", "0", ",", "self", ".", "M", ".", "n", "F", "-1", "],[", "0", ",", "1", "]))", ",", " ", "shape", "=(", "self", ".", "M", ".", "n", "F", ",", " ", "2", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", ",_", "Pin_", ",_", "Pou", "t_", "=_", "self_", "._", "M_", "._", "get", "BC", "Proj", "WF", "_", "(_", "'", "diri", "chl", "et", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Mc", "_", "=_", "self_", "._", "M_", "._", "get", "Face", "In", "ner", "Product_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mc", "I_", "=_", "Utils_", "._", "sd", "Inv", "_", "(_", "self_", "._", "M_", "._", "get", "Face", "In", "ner", "Product_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "=_", "-_", "self_", "._", "M_", "._", "face", "Div_", "._", "T_", "*_", "Utils_", "._", "sdi", "ag_", "(_", "self_", "._", "M_", "._", "vol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "D_", "=_", "self_", "._", "M_", "._", "face", "Div_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "Mc", "I_", "*_", "(_", "G_", "*_", "xc", "\\u", "ana", "_", "+_", "P_", "*_", "bc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "D_", "*_", "j_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "M", ".", "plot", "Image", "(", "j", ",", " ", "'", "Fx", "Fy", "',", " ", "show", "It", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rea", "rra", "nge", " ", "if", " ", "we", " ", "know", " ", "q", " ", "to", " ", "solve", " ", "for", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "D_", "*_", "Mc", "I_", "*_", "G_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rhs_", "=_", "q", "\\u", "ana", "_", "-_", "D_", "*_", "Mc", "I_", "*_", "P_", "*_", "bc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "my", "Test_", "==_", "'", "j", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "j_", "-_", "j", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "q", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "q_", "-_", "q", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "xc", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xc_", "=_", "Solver_", "(_", "A_", ")_", "*_", "(_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "xc_", "-_", "xc", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "xc", "J", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xc_", "=_", "Solver_", "(_", "A_", ")_", "*_", "(_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "Mc", "I_", "*_", "(_", "G_", "*_", "xc_", "+_", "P_", "*_", "bc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "j_", "-_", "j", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "err_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "1", "D", "\\u", "In", "homogene", "ous", "Neu", "man", "n_", "(_", "Tests_", "._", "Order", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Test", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phi_", "=_", "lambda_", "x_", ":_", "np_", "._", "sin_", "(_", "np_", "._", "pi_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "fun_", "=_", "lambda_", "x_", ":_", "np_", "._", "pi_", "*_", "np_", "._", "cos_", "(_", "np_", "._", "pi_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "fun_", "=_", "lambda_", "x_", ":_", "-_", "(_", "np_", "._", "pi_", "**_", "2_", ")_", "*_", "np_", "._", "sin_", "(_", "np_", "._", "pi_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xc", "\\u", "ana", "_", "=_", "phi_", "(_", "self_", "._", "M_", "._", "grid", "CC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "ana", "_", "=_", "q", "\\u", "fun_", "(_", "self_", "._", "M_", "._", "grid", "CC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "ana", "_", "=_", "j", "\\u", "fun_", "(_", "self_", "._", "M_", "._", "grid", "Fx", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", ":", " ", "Check", " ", "where", " ", "our", " ", "bound", "ary", " ", "condition", "s", " ", "are", " ", "CC", "x", " ", "or", " ", "Nx", "_", "\\u\\u\\uNL\\u\\u\\u_", "vec", "N_", "=_", "self_", "._", "M_", "._", "vector", "Nx", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vec", "C_", "=_", "self_", "._", "M_", "._", "vector", "CC", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "phi", "\\u", "bc_", "=_", "phi_", "(_", "vec", "C_", "[_", "[_", "0_", ",_", "-_", "1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "bc_", "=_", "j", "\\u", "fun_", "(_", "vec", "N_", "[_", "[_", "0_", ",_", "-_", "1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", ",_", "Pin_", ",_", "Pou", "t_", "=_", "self_", "._", "M_", "._", "get", "BC", "Proj", "WF", "_", "(_", "[_", "[_", "'", "neu", "man", "n", "'_", ",_", "'", "neu", "man", "n", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Mc", "_", "=_", "self_", "._", "M_", "._", "get", "Face", "In", "ner", "Product_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mc", "I_", "=_", "Utils_", "._", "sd", "Inv", "_", "(_", "self_", "._", "M_", "._", "get", "Face", "In", "ner", "Product_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "V_", "=_", "Utils_", "._", "sdi", "ag_", "(_", "self_", "._", "M_", "._", "vol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "=_", "-_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "self_", "._", "M_", "._", "face", "Div_", "._", "T_", "*_", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "D_", "=_", "self_", "._", "M_", "._", "face", "Div_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "Mc", "I_", "*_", "(_", "G_", "*_", "xc", "\\u", "ana", "_", "+_", "P_", "*_", "phi", "\\u", "bc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "V_", "*_", "D_", "*_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "j_", "+_", "V_", "*_", "D_", "*_", "Pou", "t_", "._", "T_", "*_", "j", "\\u", "bc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rea", "rra", "nge", " ", "if", " ", "we", " ", "know", " ", "q", " ", "to", " ", "solve", " ", "for", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "V_", "*_", "D_", "*_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "Mc", "I_", "*_", "G_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rhs_", "=_", "V_", "*_", "q", "\\u", "ana", "_", "-_", "V_", "*_", "D_", "*_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "Mc", "I_", "*_", "P_", "*_", "phi", "\\u", "bc_", "-_", "V_", "*_", "D_", "*_", "Pou", "t_", "._", "T_", "*_", "j", "\\u", "bc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "=", " ", "D", "*", "Mc", "I", "*", "G_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rhs", " ", "=", " ", "q", "\\u", "ana", " ", "-", " ", "D", "*", "Mc", "I", "*", "P", "*", "phi", "\\u", "bc_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "my", "Test_", "==_", "'", "j", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "Pin_", "*_", "j_", "-_", "Pin_", "*_", "j", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "q", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "q_", "-_", "V_", "*_", "q", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "xc", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "fix", " ", "the", " ", "null", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xc_", ",_", "info_", "=_", "sp_", "._", "linalg_", "._", "min", "res_", "(_", "A_", ",_", "rhs_", ",_", "tol_", "=_", "1e-6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "xc_", "-_", "xc", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Solve", " ", "doe", "s", " ", "not", " ", "work", " ", "well", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "ACC", "URA", "CY", "'_", ",_", "np_", "._", "linalg_", "._", "norm_", "(_", "Utils_", "._", "mkv", "c_", "(_", "A_", "*_", "xc_", ")_", "-_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "xc", "J", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "fix", " ", "the", " ", "null", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xc_", ",_", "info_", "=_", "sp_", "._", "linalg_", "._", "min", "res_", "(_", "A_", ",_", "rhs_", ",_", "tol_", "=_", "1e-6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "Mc", "I_", "*_", "(_", "G_", "*_", "xc_", "+_", "P_", "*_", "phi", "\\u", "bc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "Pin_", "*_", "j_", "-_", "Pin_", "*_", "j", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Solve", " ", "doe", "s", " ", "not", " ", "work", " ", "well", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "ACC", "URA", "CY", "'_", ",_", "np_", "._", "linalg_", "._", "norm_", "(_", "Utils_", "._", "mkv", "c_", "(_", "A_", "*_", "xc_", ")_", "-_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "err_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "2", "D", "\\u", "In", "homogene", "ous", "Neu", "man", "n_", "(_", "Tests_", "._", "Order", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Test", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phi_", "=_", "lambda_", "x_", ":_", "np_", "._", "sin_", "(_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "0_", "]_", ")_", "*_", "np_", "._", "sin_", "(_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "fun", "X_", "=_", "lambda_", "x_", ":_", "np_", "._", "pi_", "*_", "np_", "._", "cos_", "(_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "0_", "]_", ")_", "*_", "np_", "._", "sin_", "(_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "fun", "Y_", "=_", "lambda_", "x_", ":_", "np_", "._", "pi_", "*_", "np_", "._", "sin_", "(_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "0_", "]_", ")_", "*_", "np_", "._", "cos_", "(_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "fun_", "=_", "lambda_", "x_", ":_", "-_", "2_", "*_", "(_", "np_", "._", "pi_", "**_", "2_", ")_", "*_", "phi_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xc", "\\u", "ana", "_", "=_", "phi_", "(_", "self_", "._", "M_", "._", "grid", "CC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "ana", "_", "=_", "q", "\\u", "fun_", "(_", "self_", "._", "M_", "._", "grid", "CC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "X", "\\u", "ana", "_", "=_", "j", "\\u", "fun", "X_", "(_", "self_", "._", "M_", "._", "grid", "Fx", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "Y", "\\u", "ana", "_", "=_", "j", "\\u", "fun", "Y_", "(_", "self_", "._", "M_", "._", "grid", "Fy", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "ana", "_", "=_", "np_", "._", "r\\u_", "[_", "j", "X", "\\u", "ana", "_", ",_", "j", "Y", "\\u", "ana", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", ":", " ", "Check", " ", "where", " ", "our", " ", "bound", "ary", " ", "condition", "s", " ", "are", " ", "CC", "x", " ", "or", " ", "Nx", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cx", "m_", ",_", "cx", "p_", ",_", "cy", "m_", ",_", "cy", "p_", "=_", "self_", "._", "M_", "._", "cell", "Boundar", "y", "Ind_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fx", "m_", ",_", "fx", "p_", ",_", "fy", "m_", ",_", "fy", "p_", "=_", "self_", "._", "M_", "._", "face", "Boundar", "y", "Ind_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g", "BF", "x_", "=_", "self_", "._", "M_", "._", "grid", "Fx", "_", "[_", "(_", "fx", "m_", "|_", "fx", "p_", ")_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "BF", "y_", "=_", "self_", "._", "M_", "._", "grid", "Fy", "_", "[_", "(_", "fy", "m_", "|_", "fy", "p_", ")_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g", "BC", "x_", "=_", "self_", "._", "M_", "._", "grid", "CC_", "[_", "(_", "cx", "m_", "|_", "cx", "p_", ")_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "BC", "y_", "=_", "self_", "._", "M_", "._", "grid", "CC_", "[_", "(_", "cy", "m_", "|_", "cy", "p_", ")_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "phi", "\\u", "bc_", "=_", "phi_", "(_", "np_", "._", "r\\u_", "[_", "g", "BF", "x_", ",_", "g", "BF", "y_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "bc_", "=_", "np_", "._", "r\\u_", "[_", "j", "\\u", "fun", "X_", "(_", "g", "BF", "x_", ")_", ",_", "j", "\\u", "fun", "Y_", "(_", "g", "BF", "y_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "P", " ", "=", " ", "sp", ".", "csr", "\\u", "matrix", "(([", "-1", ",", "1", "],", "([", "0", ",", "self", ".", "M", ".", "n", "F", "-1", "],[", "0", ",", "1", "]))", ",", " ", "shape", "=(", "self", ".", "M", ".", "n", "F", ",", " ", "2", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", ",_", "Pin_", ",_", "Pou", "t_", "=_", "self_", "._", "M_", "._", "get", "BC", "Proj", "WF", "_", "(_", "'", "neu", "man", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Mc", "_", "=_", "self_", "._", "M_", "._", "get", "Face", "In", "ner", "Product_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mc", "I_", "=_", "Utils_", "._", "sd", "Inv", "_", "(_", "self_", "._", "M_", "._", "get", "Face", "In", "ner", "Product_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "V_", "=_", "Utils_", "._", "sdi", "ag_", "(_", "self_", "._", "M_", "._", "vol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "=_", "-_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "self_", "._", "M_", "._", "face", "Div_", "._", "T_", "*_", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "D_", "=_", "self_", "._", "M_", "._", "face", "Div_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "Mc", "I_", "*_", "(_", "G_", "*_", "xc", "\\u", "ana", "_", "+_", "P_", "*_", "phi", "\\u", "bc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "V_", "*_", "D_", "*_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "j_", "+_", "V_", "*_", "D_", "*_", "Pou", "t_", "._", "T_", "*_", "j", "\\u", "bc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rea", "rra", "nge", " ", "if", " ", "we", " ", "know", " ", "q", " ", "to", " ", "solve", " ", "for", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "V_", "*_", "D_", "*_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "Mc", "I_", "*_", "G_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rhs_", "=_", "V_", "*_", "q", "\\u", "ana", "_", "-_", "V_", "*_", "D_", "*_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "Mc", "I_", "*_", "P_", "*_", "phi", "\\u", "bc_", "-_", "V_", "*_", "D_", "*_", "Pou", "t_", "._", "T_", "*_", "j", "\\u", "bc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "my", "Test_", "==_", "'", "j", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "Pin_", "*_", "j_", "-_", "Pin_", "*_", "j", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "q", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "q_", "-_", "V_", "*_", "q", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "xc", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "fix", " ", "the", " ", "null", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xc_", ",_", "info_", "=_", "sp_", "._", "linalg_", "._", "min", "res_", "(_", "A_", ",_", "rhs_", ",_", "tol_", "=_", "1e-6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "xc_", "-_", "xc", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Solve", " ", "doe", "s", " ", "not", " ", "work", " ", "well", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "ACC", "URA", "CY", "'_", ",_", "np_", "._", "linalg_", "._", "norm_", "(_", "Utils_", "._", "mkv", "c_", "(_", "A_", "*_", "xc_", ")_", "-_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "xc", "J", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "fix", " ", "the", " ", "null", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xc_", ",_", "info_", "=_", "sp_", "._", "linalg_", "._", "min", "res_", "(_", "A_", ",_", "rhs_", ",_", "tol_", "=_", "1e-6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "Mc", "I_", "*_", "(_", "G_", "*_", "xc_", "+_", "P_", "*_", "phi", "\\u", "bc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "Pin_", "*_", "j_", "-_", "Pin_", "*_", "j", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Solve", " ", "doe", "s", " ", "not", " ", "work", " ", "well", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "ACC", "URA", "CY", "'_", ",_", "np_", "._", "linalg_", "._", "norm_", "(_", "Utils_", "._", "mkv", "c_", "(_", "A_", "*_", "xc_", ")_", "-_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "err_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "1", "D", "\\u", "In", "homogene", "ous", "Mix", "ed_", "(_", "Tests_", "._", "Order", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Test", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phi_", "=_", "lambda_", "x_", ":_", "np_", "._", "cos_", "(_", "0.5_", "*_", "np_", "._", "pi_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "fun_", "=_", "lambda_", "x_", ":_", "-_", "0.5_", "*_", "np_", "._", "pi_", "*_", "np_", "._", "sin_", "(_", "0.5_", "*_", "np_", "._", "pi_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "fun_", "=_", "lambda_", "x_", ":_", "-_", "0.25_", "*_", "(_", "np_", "._", "pi_", "**_", "2_", ")_", "*_", "np_", "._", "cos_", "(_", "0.5_", "*_", "np_", "._", "pi_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xc", "\\u", "ana", "_", "=_", "phi_", "(_", "self_", "._", "M_", "._", "grid", "CC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "ana", "_", "=_", "q", "\\u", "fun_", "(_", "self_", "._", "M_", "._", "grid", "CC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "ana", "_", "=_", "j", "\\u", "fun_", "(_", "self_", "._", "M_", "._", "grid", "Fx", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", ":", " ", "Check", " ", "where", " ", "our", " ", "bound", "ary", " ", "condition", "s", " ", "are", " ", "CC", "x", " ", "or", " ", "Nx", "_", "\\u\\u\\uNL\\u\\u\\u_", "vec", "N_", "=_", "self_", "._", "M_", "._", "vector", "Nx", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vec", "C_", "=_", "self_", "._", "M_", "._", "vector", "CC", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "phi", "\\u", "bc_", "=_", "phi_", "(_", "vec", "C_", "[_", "[_", "0_", ",_", "-_", "1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "bc_", "=_", "j", "\\u", "fun_", "(_", "vec", "N_", "[_", "[_", "0_", ",_", "-_", "1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", ",_", "Pin_", ",_", "Pou", "t_", "=_", "self_", "._", "M_", "._", "get", "BC", "Proj", "WF", "_", "(_", "[_", "[_", "'", "diri", "chl", "et", "'_", ",_", "'", "neu", "man", "n", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Mc", "_", "=_", "self_", "._", "M_", "._", "get", "Face", "In", "ner", "Product_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mc", "I_", "=_", "Utils_", "._", "sd", "Inv", "_", "(_", "self_", "._", "M_", "._", "get", "Face", "In", "ner", "Product_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "V_", "=_", "Utils_", "._", "sdi", "ag_", "(_", "self_", "._", "M_", "._", "vol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "=_", "-_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "self_", "._", "M_", "._", "face", "Div_", "._", "T_", "*_", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "D_", "=_", "self_", "._", "M_", "._", "face", "Div_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "Mc", "I_", "*_", "(_", "G_", "*_", "xc", "\\u", "ana", "_", "+_", "P_", "*_", "phi", "\\u", "bc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "V_", "*_", "D_", "*_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "j_", "+_", "V_", "*_", "D_", "*_", "Pou", "t_", "._", "T_", "*_", "j", "\\u", "bc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rea", "rra", "nge", " ", "if", " ", "we", " ", "know", " ", "q", " ", "to", " ", "solve", " ", "for", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "V_", "*_", "D_", "*_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "Mc", "I_", "*_", "G_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rhs_", "=_", "V_", "*_", "q", "\\u", "ana", "_", "-_", "V_", "*_", "D_", "*_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "Mc", "I_", "*_", "P_", "*_", "phi", "\\u", "bc_", "-_", "V_", "*_", "D_", "*_", "Pou", "t_", "._", "T_", "*_", "j", "\\u", "bc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "=", " ", "D", "*", "Mc", "I", "*", "G_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rhs", " ", "=", " ", "q", "\\u", "ana", " ", "-", " ", "D", "*", "Mc", "I", "*", "P", "*", "phi", "\\u", "bc_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "my", "Test_", "==_", "'", "j", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "Pin_", "*_", "j_", "-_", "Pin_", "*_", "j", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "q", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "q_", "-_", "V_", "*_", "q", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "xc", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "fix", " ", "the", " ", "null", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xc_", ",_", "info_", "=_", "sp_", "._", "linalg_", "._", "min", "res_", "(_", "A_", ",_", "rhs_", ",_", "tol_", "=_", "1e-6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "xc_", "-_", "xc", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Solve", " ", "doe", "s", " ", "not", " ", "work", " ", "well", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "ACC", "URA", "CY", "'_", ",_", "np_", "._", "linalg_", "._", "norm_", "(_", "Utils_", "._", "mkv", "c_", "(_", "A_", "*_", "xc_", ")_", "-_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "xc", "J", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "fix", " ", "the", " ", "null", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xc_", ",_", "info_", "=_", "sp_", "._", "linalg_", "._", "min", "res_", "(_", "A_", ",_", "rhs_", ",_", "tol_", "=_", "1e-6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "Mc", "I_", "*_", "(_", "G_", "*_", "xc_", "+_", "P_", "*_", "phi", "\\u", "bc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "Pin_", "*_", "j_", "-_", "Pin_", "*_", "j", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Solve", " ", "doe", "s", " ", "not", " ", "work", " ", "well", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "ACC", "URA", "CY", "'_", ",_", "np_", "._", "linalg_", "._", "norm_", "(_", "Utils_", "._", "mkv", "c_", "(_", "A_", "*_", "xc_", ")_", "-_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "err_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "2", "D", "\\u", "In", "homogene", "ous", "Mix", "ed_", "(_", "Tests_", "._", "Order", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Test", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phi_", "=_", "lambda_", "x_", ":_", "np_", "._", "cos_", "(_", "0.5_", "*_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "0_", "]_", ")_", "*_", "np_", "._", "cos_", "(_", "0.5_", "*_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "fun", "X_", "=_", "lambda_", "x_", ":_", "-_", "0.5_", "*_", "np_", "._", "pi_", "*_", "np_", "._", "sin_", "(_", "0.5_", "*_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "0_", "]_", ")_", "*_", "np_", "._", "cos_", "(_", "0.5_", "*_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "fun", "Y_", "=_", "lambda_", "x_", ":_", "-_", "0.5_", "*_", "np_", "._", "pi_", "*_", "np_", "._", "cos_", "(_", "0.5_", "*_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "0_", "]_", ")_", "*_", "np_", "._", "sin_", "(_", "0.5_", "*_", "np_", "._", "pi_", "*_", "x_", "[_", ":_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "fun_", "=_", "lambda_", "x_", ":_", "-_", "2_", "*_", "(_", "(_", "0.5_", "*_", "np_", "._", "pi_", ")_", "**_", "2_", ")_", "*_", "phi_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xc", "\\u", "ana", "_", "=_", "phi_", "(_", "self_", "._", "M_", "._", "grid", "CC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "\\u", "ana", "_", "=_", "q", "\\u", "fun_", "(_", "self_", "._", "M_", "._", "grid", "CC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "X", "\\u", "ana", "_", "=_", "j", "\\u", "fun", "X_", "(_", "self_", "._", "M_", "._", "grid", "Fx", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "Y", "\\u", "ana", "_", "=_", "j", "\\u", "fun", "Y_", "(_", "self_", "._", "M_", "._", "grid", "Fy", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "ana", "_", "=_", "np_", "._", "r\\u_", "[_", "j", "X", "\\u", "ana", "_", ",_", "j", "Y", "\\u", "ana", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", ":", " ", "Check", " ", "where", " ", "our", " ", "bound", "ary", " ", "condition", "s", " ", "are", " ", "CC", "x", " ", "or", " ", "Nx", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cx", "m_", ",_", "cx", "p_", ",_", "cy", "m_", ",_", "cy", "p_", "=_", "self_", "._", "M_", "._", "cell", "Boundar", "y", "Ind_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fx", "m_", ",_", "fx", "p_", ",_", "fy", "m_", ",_", "fy", "p_", "=_", "self_", "._", "M_", "._", "face", "Boundar", "y", "Ind_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g", "BF", "x_", "=_", "self_", "._", "M_", "._", "grid", "Fx", "_", "[_", "(_", "fx", "m_", "|_", "fx", "p_", ")_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "BF", "y_", "=_", "self_", "._", "M_", "._", "grid", "Fy", "_", "[_", "(_", "fy", "m_", "|_", "fy", "p_", ")_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g", "BC", "x_", "=_", "self_", "._", "M_", "._", "grid", "CC_", "[_", "(_", "cx", "m_", "|_", "cx", "p_", ")_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "BC", "y_", "=_", "self_", "._", "M_", "._", "grid", "CC_", "[_", "(_", "cy", "m_", "|_", "cy", "p_", ")_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "phi", "\\u", "bc_", "=_", "phi_", "(_", "np_", "._", "r\\u_", "[_", "g", "BC", "x_", ",_", "g", "BC", "y_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "\\u", "bc_", "=_", "np_", "._", "r\\u_", "[_", "j", "\\u", "fun", "X_", "(_", "g", "BF", "x_", ")_", ",_", "j", "\\u", "fun", "Y_", "(_", "g", "BF", "y_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "P", " ", "=", " ", "sp", ".", "csr", "\\u", "matrix", "(([", "-1", ",", "1", "],", "([", "0", ",", "self", ".", "M", ".", "n", "F", "-1", "],[", "0", ",", "1", "]))", ",", " ", "shape", "=(", "self", ".", "M", ".", "n", "F", ",", " ", "2", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", ",_", "Pin_", ",_", "Pou", "t_", "=_", "self_", "._", "M_", "._", "get", "BC", "Proj", "WF", "_", "(_", "[_", "[_", "'", "diri", "chl", "et", "'_", ",_", "'", "neu", "man", "n", "'_", "]_", ",_", "[_", "'", "diri", "chl", "et", "'_", ",_", "'", "neu", "man", "n", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Mc", "_", "=_", "self_", "._", "M_", "._", "get", "Face", "In", "ner", "Product_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mc", "I_", "=_", "Utils_", "._", "sd", "Inv", "_", "(_", "self_", "._", "M_", "._", "get", "Face", "In", "ner", "Product_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "V_", "=_", "Utils_", "._", "sdi", "ag_", "(_", "self_", "._", "M_", "._", "vol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "=_", "-_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "self_", "._", "M_", "._", "face", "Div_", "._", "T_", "*_", "V_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "D_", "=_", "self_", "._", "M_", "._", "face", "Div_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "Mc", "I_", "*_", "(_", "G_", "*_", "xc", "\\u", "ana", "_", "+_", "P_", "*_", "phi", "\\u", "bc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "V_", "*_", "D_", "*_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "j_", "+_", "V_", "*_", "D_", "*_", "Pou", "t_", "._", "T_", "*_", "j", "\\u", "bc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rea", "rra", "nge", " ", "if", " ", "we", " ", "know", " ", "q", " ", "to", " ", "solve", " ", "for", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "V_", "*_", "D_", "*_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "Mc", "I_", "*_", "G_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rhs_", "=_", "V_", "*_", "q", "\\u", "ana", "_", "-_", "V_", "*_", "D_", "*_", "Pin_", "._", "T_", "*_", "Pin_", "*_", "Mc", "I_", "*_", "P_", "*_", "phi", "\\u", "bc_", "-_", "V_", "*_", "D_", "*_", "Pou", "t_", "._", "T_", "*_", "j", "\\u", "bc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "my", "Test_", "==_", "'", "j", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "Pin_", "*_", "j_", "-_", "Pin_", "*_", "j", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "q", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "q_", "-_", "V_", "*_", "q", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "xc", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "fix", " ", "the", " ", "null", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xc_", ",_", "info_", "=_", "sp_", "._", "linalg_", "._", "min", "res_", "(_", "A_", ",_", "rhs_", ",_", "tol_", "=_", "1e-6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "xc_", "-_", "xc", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Solve", " ", "doe", "s", " ", "not", " ", "work", " ", "well", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "ACC", "URA", "CY", "'_", ",_", "np_", "._", "linalg_", "._", "norm_", "(_", "Utils_", "._", "mkv", "c_", "(_", "A_", "*_", "xc_", ")_", "-_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "my", "Test_", "==_", "'", "xc", "J", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "fix", " ", "the", " ", "null", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xc_", ",_", "info_", "=_", "sp_", "._", "linalg_", "._", "min", "res_", "(_", "A_", ",_", "rhs_", ",_", "tol_", "=_", "1e-6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "Mc", "I_", "*_", "(_", "G_", "*_", "xc_", "+_", "P_", "*_", "phi", "\\u", "bc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "Pin_", "*_", "j_", "-_", "Pin_", "*_", "j", "\\u", "ana", "_", ")_", ",_", "np_", "._", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Solve", " ", "doe", "s", " ", "not", " ", "work", " ", "well", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "ACC", "URA", "CY", "'_", ",_", "np_", "._", "linalg_", "._", "norm_", "(_", "Utils_", "._", "mkv", "c_", "(_", "A_", "*_", "xc_", ")_", "-_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "err_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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
Havate/havate-openstack/proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/test/tests/templates.py
[ { "content": " def test_openrc_html_escape(self):\n context = {\n \"user\": FakeUser(),\n \"tenant_id\": \"some-cool-id\",\n \"auth_url\": \"http://tests.com\",\n \"tenant_name\": \"ENG Perf R&D\"}\n out = loader.render_to_string(\n 'project/access_and_security/api_access/openrc.sh.template',\n context,\n template.Context(context))\n\n self.assertFalse(\"&amp;\" in out)\n self.assertTrue(\"ENG Perf R&D\" in out)", "metadata": "root.TemplateRenderTest.test_openrc_html_escape", "header": "['class', 'TemplateRenderTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": " def test_openrc_html_evil_shell_escape(self):\n context = {\n \"user\": FakeUser(),\n \"tenant_id\": \"some-cool-id\",\n \"auth_url\": \"http://tests.com\",\n \"tenant_name\": 'o\"; sudo rm -rf /'}\n out = loader.render_to_string(\n 'project/access_and_security/api_access/openrc.sh.template',\n context,\n template.Context(context))\n\n self.assertFalse('o\"' in out)\n self.assertTrue('\\\"' in out)", "metadata": "root.TemplateRenderTest.test_openrc_html_evil_shell_escape", "header": "['class', 'TemplateRenderTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 43 }, { "content": " def test_openrc_html_evil_shell_backslash_escape(self):\n context = {\n \"user\": FakeUser(),\n \"tenant_id\": \"some-cool-id\",\n \"auth_url\": \"http://tests.com\",\n \"tenant_name\": 'o\\\"; sudo rm -rf /'}\n out = loader.render_to_string(\n 'project/access_and_security/api_access/openrc.sh.template',\n context,\n template.Context(context))\n\n self.assertFalse('o\\\"' in out)\n self.assertFalse('o\"' in out)\n self.assertTrue('\\\\\"' in out)", "metadata": "root.TemplateRenderTest.test_openrc_html_evil_shell_backslash_escape", "header": "['class', 'TemplateRenderTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 57 } ]
[ { "span": "self.assertFalse(\"&amp;\" in out)", "start_line": 40, "start_column": 8, "end_line": 40, "end_column": 40 }, { "span": "self.assertTrue(\"ENG Perf R&D\" in out)", "start_line": 41, "start_column": 8, "end_line": 41, "end_column": 46 }, { "span": "self.assertFalse('o\"' in out)", "start_line": 54, "start_column": 8, "end_line": 54, "end_column": 37 }, { "span": "self.assertTrue('\\\"' in out)", "start_line": 55, "start_column": 8, "end_line": 55, "end_column": 36 }, { "span": "self.assertFalse('o\\\"' in out)", "start_line": 68, "start_column": 8, "end_line": 68, "end_column": 38 }, { "span": "self.assertFalse('o\"' in out)", "start_line": 69, "start_column": 8, "end_line": 69, "end_column": 37 }, { "span": "self.assertTrue('\\\\\"' in out)", "start_line": 70, "start_column": 8, "end_line": 70, "end_column": 37 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Templa", "te", "Render", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "open", "rc", "\\u", "html", "\\u", "escape_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "user", "\"_", ":_", "Fake", "User_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tenan", "t", "\\u", "id", "\"_", ":_", "\"", "some", "-", "cool", "-", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auth", "\\u", "url", "\"_", ":_", "\"", "http", "://", "tests", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tenan", "t", "\\u", "name", "\"_", ":_", "\"", "ENG", " ", "Perf", " ", "R", "&", "D", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "loader_", "._", "render", "\\u", "to", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "/", "access", "\\u", "and", "\\u", "security", "/", "api", "\\u", "access", "/", "open", "rc", ".", "sh", ".", "template", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "._", "Context_", "(_", "context_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\"&", "amp", ";\"_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "ENG", " ", "Perf", " ", "R", "&", "D", "\"_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Templa", "te", "Render", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "open", "rc", "\\u", "html", "\\u", "evil", "\\u", "shell", "\\u", "escape_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "user", "\"_", ":_", "Fake", "User_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tenan", "t", "\\u", "id", "\"_", ":_", "\"", "some", "-", "cool", "-", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auth", "\\u", "url", "\"_", ":_", "\"", "http", "://", "tests", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tenan", "t", "\\u", "name", "\"_", ":_", "'", "o", "\";", " ", "sudo", " ", "rm", " ", "-", "rf", " ", "/'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "loader_", "._", "render", "\\u", "to", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "/", "access", "\\u", "and", "\\u", "security", "/", "api", "\\u", "access", "/", "open", "rc", ".", "sh", ".", "template", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "._", "Context_", "(_", "context_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "o", "\"'_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'\\\\\"", "'_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Templa", "te", "Render", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "open", "rc", "\\u", "html", "\\u", "evil", "\\u", "shell", "\\u", "backslash", "\\u", "escape_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "user", "\"_", ":_", "Fake", "User_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tenan", "t", "\\u", "id", "\"_", ":_", "\"", "some", "-", "cool", "-", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auth", "\\u", "url", "\"_", ":_", "\"", "http", "://", "tests", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tenan", "t", "\\u", "name", "\"_", ":_", "'", "o", "\\\\\"", ";", " ", "sudo", " ", "rm", " ", "-", "rf", " ", "/'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "loader_", "._", "render", "\\u", "to", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "/", "access", "\\u", "and", "\\u", "security", "/", "api", "\\u", "access", "/", "open", "rc", ".", "sh", ".", "template", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "._", "Context_", "(_", "context_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "o", "\\\\\"'_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "o", "\"'_", "in_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'\\\\\\\\", "\"'_", "in_", "out_", ")_" ]
[ 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1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 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Except block handles 'BaseException'
callowayproject/django-categories/categories/templatetags/category_tags.py
[ { "content": " def render(self, context):\n category = resolve(self.category, context)\n if isinstance(category, CategoryBase):\n cat = category\n else:\n cat = get_category(category, self.model)\n try:\n if cat is not None:\n context[self.varname] = drilldown_tree_for_node(cat)\n else:\n context[self.varname] = []\n except:\n context[self.varname] = []\n return ''", "metadata": "root.CategoryDrillDownNode.render", "header": "['class', 'CategoryDrillDownNode', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 77 } ]
[ { "span": "except:", "start_line": 88, "start_column": 8, "end_line": 88, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Cate", "gory", "Dri", "ll", "Down", "Node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\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 ", " _", "category_", "=_", "resolve_", "(_", "self_", "._", "category_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "category_", ",_", "Cate", "gory", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cat_", "=_", "category_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cat_", "=_", "get", "\\u", "category_", "(_", "category_", ",_", "self_", "._", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cat_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "self_", "._", "varname_", "]_", "=_", "drill", "down", "\\u", "tree", "\\u", "for", "\\u", "node_", "(_", "cat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "self_", "._", "varname_", "]_", "=_", "[_", "]_", "\\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 ", " _", "context_", "[_", "self_", "._", "varname_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "''_", "\\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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dansanderson/picotool/tests/pico8/map/map_test.py
[ { "content": "#!/usr/bin/env python3\n\nimport unittest\nfrom unittest.mock import Mock\nfrom unittest.mock import patch\n\nfrom pico8.gfx import gfx\nfrom pico8.map import map\n\n\n\n \nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestMap(unittest.TestCase):\n \n\n\n\n\n\n ", "metadata": "root.TestMap", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def testGetCell(self):\n m = map.Map.empty()\n m._data[0:128] = (b'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07'\n b'\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\x0f') * 8\n for i in range(16):\n for j in range(8):\n self.assertEqual(i, m.get_cell(i + 16 * j, 0))\n for i in range(16):\n for j in range(8):\n self.assertEqual(0, m.get_cell(i + 16 * j, 1))", "metadata": "root.TestMap.testGetCell", "header": "['class', 'TestMap', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 11 }, { "content": " def testGetCellSharedMem(self):\n m = map.Map.empty()\n m._gfx = gfx.Gfx.empty()\n m._gfx._data[4096:4112] = (b'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07'\n b'\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\x0f') * 8\n for i in range(16):\n self.assertEqual(i, m.get_cell(i, 32))", "metadata": "root.TestMap.testGetCellSharedMem", "header": "['class', 'TestMap', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def testSetCell(self):\n m = map.Map.empty()\n for i in range(16):\n for j in range(8):\n m.set_cell(i + 16 * j, 0, i)\n for i in range(16):\n for j in range(8):\n self.assertEqual(i, m.get_cell(i + 16 * j, 0))\n for i in range(16):\n for j in range(8):\n self.assertEqual(0, m.get_cell(i + 16 * j, 1))", "metadata": "root.TestMap.testSetCell", "header": "['class', 'TestMap', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 30 }, { "content": " def testGetRectTiles(self):\n m = map.Map.empty()\n for i in range(16):\n for j in range(8):\n m.set_cell(i + 16 * j, 0, i)\n tile_rect = m.get_rect_tiles(2, 0, width=8, height=2)\n self.assertEqual(2, len(tile_rect))\n self.assertEqual(8, len(tile_rect[0]))\n self.assertEqual(bytearray(\n b'\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09'),\n tile_rect[0])\n self.assertEqual(bytearray(b'\\x00') * 8, tile_rect[1])", "metadata": "root.TestMap.testGetRectTiles", "header": "['class', 'TestMap', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 42 }, { "content": " def testGetRectTilesOffEdge(self):\n m = map.Map.empty()\n for i in range(16):\n for j in range(8):\n m.set_cell(i + 16 * j, 0, i)\n tile_rect = m.get_rect_tiles(124, 0, width=8, height=2)\n self.assertEqual(2, len(tile_rect))\n self.assertEqual(8, len(tile_rect[0]))\n self.assertEqual(bytearray(\n b'\\x0c\\x0d\\x0e\\x0f\\x00\\x00\\x00\\x00'),\n tile_rect[0])\n self.assertEqual(bytearray(b'\\x00') * 8, tile_rect[1])", "metadata": "root.TestMap.testGetRectTilesOffEdge", "header": "['class', 'TestMap', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 55 }, { "content": " def testGetRectSharedMem(self):\n m = map.Map.empty()\n m._gfx = gfx.Gfx.empty()\n m._gfx._data[4096:4112] = (b'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07'\n b'\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\x0f') * 8\n tile_rect = m.get_rect_tiles(2, 32, width=8, height=2)\n self.assertEqual(2, len(tile_rect))\n self.assertEqual(8, len(tile_rect[0]))\n self.assertEqual(bytearray(\n b'\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09'),\n tile_rect[0])\n self.assertEqual(bytearray(b'\\x00') * 8, tile_rect[1])", "metadata": "root.TestMap.testGetRectSharedMem", "header": "['class', 'TestMap', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def testSetRectTiles(self):\n m = map.Map.empty()\n m._gfx = gfx.Gfx.empty()\n m.set_rect_tiles([[1] * 4] * 3, 2, 3)\n result = m.get_rect_tiles(0, 0, width=7, height=7)\n self.assertEqual(\n [bytearray(b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00'),\n bytearray(b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00'),\n bytearray(b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00'),\n bytearray(b'\\x00\\x00\\x01\\x01\\x01\\x01\\x00'),\n bytearray(b'\\x00\\x00\\x01\\x01\\x01\\x01\\x00'),\n bytearray(b'\\x00\\x00\\x01\\x01\\x01\\x01\\x00'),\n bytearray(b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00')], result)", "metadata": "root.TestMap.testSetRectTiles", "header": "['class', 'TestMap', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 81 }, { "content": " def testGetRectPixels(self):\n m = map.Map.empty()\n m._gfx = gfx.Gfx.empty()\n for i in range(16):\n m._gfx.set_sprite(i, [[i] * 8] * 8)\n for i in range(16):\n for j in range(8):\n m.set_cell(i + 16 * j, 0, i)\n pixels = m.get_rect_pixels(2, 0, width=3, height=2)\n self.assertEqual(16, len(pixels))\n self.assertEqual(24, len(pixels[0]))\n for i in range(0,8):\n self.assertEqual(bytearray(b'\\x02' * 8 + b'\\x03' * 8 + b'\\x04' * 8),\n pixels[i])\n for i in range(8,16):\n self.assertEqual(bytearray(b'\\x00' * 24), pixels[i])", "metadata": "root.TestMap.testGetRectPixels", "header": "['class', 'TestMap', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 95 } ]
[ { "span": "from unittest.mock import Mock", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 30 }, { "span": "from unittest.mock import patch", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "unittest_", "._", "mock_", "import_", "Mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "unittest_", "._", "mock_", "import_", "patch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pico", "8_", "._", "gfx", "_", "import_", "gfx", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pico", "8_", "._", "map_", "import_", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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", "Map_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Map_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Get", "Cell_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "map_", "._", "Map_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "\\u", "data_", "[_", "0_", ":_", "128_", "]_", "=_", "(_", "b", "'\\\\", "x0", "0", "\\\\", "x0", "1", "\\\\", "x0", "2", "\\\\", "x0", "3", "\\\\", "x0", "4", "\\\\", "x0", "5", "\\\\", "x0", "6", "\\\\", "x0", "7", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'\\\\", "x0", "8", "\\\\", "x0", "9", "\\\\", "x0", "a", "\\\\", "x0", "b", "\\\\", "x0", "c", "\\\\", "x0", "d", "\\\\", "x0", "e", "\\\\", "x0", "f", "'_", ")_", "*_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "16_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "8_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "i_", ",_", "m_", "._", "get", "\\u", "cell_", "(_", "i_", "+_", "16_", "*_", "j_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "16_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "8_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "m_", "._", "get", "\\u", "cell_", "(_", "i_", "+_", "16_", "*_", "j_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Map_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Cel", "l", "Share", "d", "Mem", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "map_", "._", "Map_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "\\u", "gfx", "_", "=_", "gfx", "_", "._", "Gf", "x_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "\\u", "gfx", "_", "._", "\\u", "data_", "[_", "4096_", ":_", "4112", "_", "]_", "=_", "(_", "b", "'\\\\", "x0", "0", "\\\\", "x0", "1", "\\\\", "x0", "2", "\\\\", "x0", "3", "\\\\", "x0", "4", "\\\\", "x0", "5", "\\\\", "x0", "6", "\\\\", "x0", "7", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'\\\\", "x0", "8", "\\\\", "x0", "9", "\\\\", "x0", "a", "\\\\", "x0", "b", "\\\\", "x0", "c", "\\\\", "x0", "d", "\\\\", "x0", "e", "\\\\", "x0", "f", "'_", ")_", "*_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "16_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "i_", ",_", "m_", "._", "get", "\\u", "cell_", "(_", "i_", ",_", "32_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Map_", "(_", "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", "Set", "Cell_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "map_", "._", "Map_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "16_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "8_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "._", "set\\u", "cell_", "(_", "i_", "+_", "16_", "*_", "j_", ",_", "0_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "16_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "8_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "i_", ",_", "m_", "._", "get", "\\u", "cell_", "(_", "i_", "+_", "16_", "*_", "j_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "16_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "8_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "m_", "._", "get", "\\u", "cell_", "(_", "i_", "+_", "16_", "*_", "j_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Map_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Rect", "Tiles", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "map_", "._", "Map_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "16_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "8_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "._", "set\\u", "cell_", "(_", "i_", "+_", "16_", "*_", "j_", ",_", "0_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tile", "\\u", "rect_", "=_", "m_", "._", "get", "\\u", "rect", "\\u", "tiles_", "(_", "2_", ",_", "0_", ",_", "width_", "=_", "8_", ",_", "height_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "tile", "\\u", "rect_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "8_", ",_", "len_", "(_", "tile", "\\u", "rect_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytearray_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'\\\\", "x0", "2", "\\\\", "x0", "3", "\\\\", "x0", "4", "\\\\", "x0", "5", "\\\\", "x0", "6", "\\\\", "x0", "7", "\\\\", "x0", "8", "\\\\", "x0", "9", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tile", "\\u", "rect_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytearray_", "(_", "b", "'\\\\", "x0", "0", "'_", ")_", "*_", "8_", ",_", "tile", "\\u", "rect_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Map_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Rect", "Tiles", "Off", "Edge_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "map_", "._", "Map_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "16_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "8_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "._", "set\\u", "cell_", "(_", "i_", "+_", "16_", "*_", "j_", ",_", "0_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tile", "\\u", "rect_", "=_", "m_", "._", "get", "\\u", "rect", "\\u", "tiles_", "(_", "124_", ",_", "0_", ",_", "width_", "=_", "8_", ",_", "height_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "tile", "\\u", "rect_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "8_", ",_", "len_", "(_", "tile", "\\u", "rect_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytearray_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'\\\\", "x0", "c", "\\\\", "x0", "d", "\\\\", "x0", "e", "\\\\", "x0", "f", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tile", "\\u", "rect_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytearray_", "(_", "b", "'\\\\", "x0", "0", "'_", ")_", "*_", "8_", ",_", "tile", "\\u", "rect_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Map_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Rect", "Share", "d", "Mem", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "map_", "._", "Map_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "\\u", "gfx", "_", "=_", "gfx", "_", "._", "Gf", "x_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "\\u", "gfx", "_", "._", "\\u", "data_", "[_", "4096_", ":_", "4112", "_", "]_", "=_", "(_", "b", "'\\\\", "x0", "0", "\\\\", "x0", "1", "\\\\", "x0", "2", "\\\\", "x0", "3", "\\\\", "x0", "4", "\\\\", "x0", "5", "\\\\", "x0", "6", "\\\\", "x0", "7", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'\\\\", "x0", "8", "\\\\", "x0", "9", "\\\\", "x0", "a", "\\\\", "x0", "b", "\\\\", "x0", "c", "\\\\", "x0", "d", "\\\\", "x0", "e", "\\\\", "x0", "f", "'_", ")_", "*_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tile", "\\u", "rect_", "=_", "m_", "._", "get", "\\u", "rect", "\\u", "tiles_", "(_", "2_", ",_", "32_", ",_", "width_", "=_", "8_", ",_", "height_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "tile", "\\u", "rect_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "8_", ",_", "len_", "(_", "tile", "\\u", "rect_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytearray_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'\\\\", "x0", "2", "\\\\", "x0", "3", "\\\\", "x0", "4", "\\\\", "x0", "5", "\\\\", "x0", "6", "\\\\", "x0", "7", "\\\\", "x0", "8", "\\\\", "x0", "9", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tile", "\\u", "rect_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytearray_", "(_", "b", "'\\\\", "x0", "0", "'_", ")_", "*_", "8_", ",_", "tile", "\\u", "rect_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Map_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Set", "Rect", "Tiles", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "map_", "._", "Map_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "\\u", "gfx", "_", "=_", "gfx", "_", "._", "Gf", "x_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "set\\u", "rect", "\\u", "tiles_", "(_", "[_", "[_", "1_", "]_", "*_", "4_", "]_", "*_", "3_", ",_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "m_", "._", "get", "\\u", "rect", "\\u", "tiles_", "(_", "0_", ",_", "0_", ",_", "width_", "=_", "7_", ",_", "height_", "=_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "bytearray_", "(_", "b", "'\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bytearray_", "(_", "b", "'\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bytearray_", "(_", "b", "'\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bytearray_", "(_", "b", "'\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "1", "\\\\", "x0", "1", "\\\\", "x0", "1", "\\\\", "x0", "1", "\\\\", "x0", "0", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bytearray_", "(_", "b", "'\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "1", "\\\\", "x0", "1", "\\\\", "x0", "1", "\\\\", "x0", "1", "\\\\", "x0", "0", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bytearray_", "(_", "b", "'\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "1", "\\\\", "x0", "1", "\\\\", "x0", "1", "\\\\", "x0", "1", "\\\\", "x0", "0", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bytearray_", "(_", "b", "'\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "\\\\", "x0", "0", "'_", ")_", "]_", ",_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Map_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Rect", "Pixels", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "map_", "._", "Map_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "\\u", "gfx", "_", "=_", "gfx", "_", "._", "Gf", "x_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "16_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "._", "\\u", "gfx", "_", "._", "set\\u", "sprite_", "(_", "i_", ",_", "[_", "[_", "i_", "]_", "*_", "8_", "]_", "*_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "16_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "8_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "._", "set\\u", "cell_", "(_", "i_", "+_", "16_", "*_", "j_", ",_", "0_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pixels_", "=_", "m_", "._", "get", "\\u", "rect", "\\u", "pixels_", "(_", "2_", ",_", "0_", ",_", "width_", "=_", "3_", ",_", "height_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "16_", ",_", "len_", "(_", "pixels_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "24_", ",_", "len_", "(_", "pixels_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "8_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "bytearray_", "(_", "b", "'\\\\", "x0", "2", "'_", "*_", "8_", "+_", "b", "'\\\\", "x0", "3", "'_", "*_", "8_", "+_", "b", "'\\\\", "x0", "4", "'_", "*_", "8_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pixels_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "8_", ",_", "16_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "bytearray_", "(_", "b", "'\\\\", "x0", "0", "'_", "*_", "24_", ")_", ",_", "pixels_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
mozilla/moztrap/tests/model/execution/api/test_result.py
[ { "content": " def test_submit_results_for_run(self):\n \"\"\"Submit results for an existing test run.\"\"\"\n user = self.F.UserFactory.create(\n username=\"foo\",\n permissions=[\"execution.execute\"],\n )\n apikey = self.F.ApiKeyFactory.create(owner=user)\n envs = self.F.EnvironmentFactory.create_full_set(\n {\"OS\": [\"OS X\", \"Linux\"]})\n pv = self.F.ProductVersionFactory.create(environments=envs)\n r1 = self.F.RunFactory.create(name=\"RunA\", productversion=pv)\n\n c_p = self.F.CaseVersionFactory.create(\n case__product=pv.product,\n productversion=pv,\n name=\"PassCase\",\n )\n c_i = self.F.CaseVersionFactory.create(\n case__product=pv.product,\n productversion=pv,\n name=\"InvalidCase\",\n )\n c_f = self.F.CaseVersionFactory.create(\n case__product=pv.product,\n productversion=pv,\n name=\"FailCase\",\n )\n c_b = self.F.CaseVersionFactory.create(\n case__product=pv.product,\n productversion=pv,\n name=\"BlockCase\",\n )\n c_s = self.F.CaseVersionFactory.create(\n case__product=pv.product,\n productversion=pv,\n name=\"SkipCase\",\n )\n self.F.CaseStepFactory(caseversion=c_f)\n\n self.factory.create(caseversion=c_p, run=r1, environments=envs)\n self.factory.create(caseversion=c_i, run=r1, environments=envs)\n self.factory.create(caseversion=c_f, run=r1, environments=envs)\n self.factory.create(caseversion=c_b, run=r1, environments=envs)\n self.factory.create(caseversion=c_s, run=r1, environments=envs)\n\n # submit results for these cases\n params = {\"username\": user.username, \"api_key\": apikey.key}\n payload = {\n \"objects\": [\n {\n \"case\": c_p.case.id,\n \"environment\": envs[0].id,\n \"run_id\": r1.id,\n \"status\": \"passed\"\n },\n {\n \"case\": c_s.case.id,\n \"environment\": envs[0].id,\n \"run_id\": r1.id,\n \"status\": \"skipped\"\n },\n {\n \"case\": c_i.case.id,\n \"comment\": \"why u no make sense??\",\n \"environment\": envs[0].id,\n \"run_id\": r1.id,\n \"status\": \"invalidated\"\n },\n {\n \"case\": c_b.case.id,\n \"comment\": \"why u no run??\",\n \"environment\": envs[0].id,\n \"run_id\": r1.id,\n \"status\": \"blocked\"\n },\n {\n \"bug\": \"http://www.deathvalleydogs.com\",\n \"case\": c_f.case.id,\n \"comment\": \"why u no pass?\",\n \"environment\": envs[0].id,\n \"run_id\": r1.id,\n \"status\": \"failed\",\n \"stepnumber\": 1\n }\n ]\n }\n\n\n res = self.patch(\n self.get_list_url(self.resource_name),\n params=params,\n payload=payload,\n )\n\n# assert False, res.text\n\n # verify pass results\n result = self.model.Result.objects.get(runcaseversion__caseversion=c_p)\n self.assertEqual(result.status, \"passed\")\n self.assertEqual(result.environment, envs[0])\n\n # verify fail results\n result = self.model.Result.objects.get(runcaseversion__caseversion=c_f)\n self.assertEqual(result.status, \"failed\")\n self.assertEqual(result.comment, \"why u no pass?\")\n self.assertEqual(set(result.bug_urls()), set([\"http://www.deathvalleydogs.com\"]))\n self.assertEqual(result.environment, envs[0])\n\n # verify invalid results\n result = self.model.Result.objects.get(runcaseversion__caseversion=c_i)\n self.assertEqual(result.status, \"invalidated\")\n self.assertEqual(result.environment, envs[0])\n self.assertEqual(result.comment, \"why u no make sense??\")", "metadata": "root.ResultResourceTest.test_submit_results_for_run", "header": "['class', 'ResultResourceTest', '(', 'case', '.', 'api', '.', 'ApiTestCase', ')', ':', '___EOS___']", "index": 25 }, { "content": " def test_submit_results_for_run_no_status(self):\n \"\"\"Submit results for an existing test run without a status.\"\"\"\n user = self.F.UserFactory.create(\n username=\"foo\",\n permissions=[\"execution.execute\"],\n )\n apikey = self.F.ApiKeyFactory.create(owner=user)\n envs = self.F.EnvironmentFactory.create_full_set(\n {\"OS\": [\"OS X\"]})\n pv = self.F.ProductVersionFactory.create(environments=envs)\n r1 = self.F.RunFactory.create(name=\"RunA\", productversion=pv)\n\n c_p = self.F.CaseVersionFactory.create(\n case__product=pv.product,\n productversion=pv,\n name=\"PassCase\",\n )\n\n self.factory.create(caseversion=c_p, run=r1)\n\n # submit results for these cases\n params = {\"username\": user.username, \"api_key\": apikey.key}\n payload = {\n \"objects\": [\n {\n \"case\": c_p.case.id,\n \"environment\": envs[0].id,\n \"run_id\": r1.id,\n }\n ]\n }\n\n res = self.patch(\n self.get_list_url(self.resource_name),\n params=params,\n payload=payload,\n status=400,\n )", "metadata": "root.ResultResourceTest.test_submit_results_for_run_no_status", "header": "['class', 'ResultResourceTest', '(', 'case', '.', 'api', '.', 'ApiTestCase', ')', ':', '___EOS___']", "index": 140 }, { "content": " def test_submit_results_for_run_bad_env_id(self):\n \"\"\"Submit results for an existing test run with a bad env id.\"\"\"\n user = self.F.UserFactory.create(\n username=\"foo\",\n permissions=[\"execution.execute\"],\n )\n apikey = self.F.ApiKeyFactory.create(owner=user)\n envs = self.F.EnvironmentFactory.create_full_set(\n {\"OS\": [\"OS X\"]})\n pv = self.F.ProductVersionFactory.create(environments=envs)\n r1 = self.F.RunFactory.create(name=\"RunA\", productversion=pv)\n\n c_p = self.F.CaseVersionFactory.create(\n case__product=pv.product,\n productversion=pv,\n name=\"PassCase\",\n )\n\n self.factory.create(caseversion=c_p, run=r1)\n\n # submit results for these cases\n params = {\"username\": user.username, \"api_key\": apikey.key}\n payload = {\n \"objects\": [\n {\n \"case\": c_p.case.id,\n \"environment\": envs[0].id + 1,\n \"run_id\": r1.id,\n \"status\": \"passed\",\n }\n ]\n }\n\n res = self.patch(\n self.get_list_url(self.resource_name),\n params=params,\n payload=payload,\n status=400,\n )", "metadata": "root.ResultResourceTest.test_submit_results_for_run_bad_env_id", "header": "['class', 'ResultResourceTest', '(', 'case', '.', 'api', '.', 'ApiTestCase', ')', ':', '___EOS___']", "index": 180 }, { "content": " def test_submit_results_for_run_no_runcaseversion(self):\n \"\"\"Submit results for an existing test run when a runcaseversion doesn't exist.\"\"\"\n user = self.F.UserFactory.create(\n username=\"foo\",\n permissions=[\"execution.execute\"],\n )\n apikey = self.F.ApiKeyFactory.create(owner=user)\n envs = self.F.EnvironmentFactory.create_full_set(\n {\"OS\": [\"OS X\", \"Linux\"]})\n pv = self.F.ProductVersionFactory.create(environments=envs)\n r1 = self.F.RunFactory.create(name=\"RunA\", productversion=pv)\n\n c_p = self.F.CaseVersionFactory.create(\n case__product=pv.product,\n productversion=pv,\n name=\"PassCase\",\n )\n\n # submit results for these cases\n params = {\"username\": user.username, \"api_key\": apikey.key}\n payload = {\n \"objects\": [\n {\n \"case\": c_p.case.id,\n \"environment\": envs[0].id,\n \"run_id\": r1.id,\n \"status\": \"passed\"\n },\n ]\n }\n\n res = self.patch(\n self.get_list_url(self.resource_name),\n params=params,\n payload=payload,\n status=400,\n )", "metadata": "root.ResultResourceTest.test_submit_results_for_run_no_runcaseversion", "header": "['class', 'ResultResourceTest', '(', 'case', '.', 'api', '.', 'ApiTestCase', ')', ':', '___EOS___']", "index": 221 }, { "content": " def test_submit_results_for_run_no_authentication(self):\n \"\"\"Submit results for an existing test run by non-user.\"\"\"\n envs = self.F.EnvironmentFactory.create_full_set(\n {\"OS\": [\"OS X\", \"Linux\"]})\n pv = self.F.ProductVersionFactory.create(environments=envs)\n r1 = self.F.RunFactory.create(name=\"RunA\", productversion=pv)\n\n c_p = self.F.CaseVersionFactory.create(\n case__product=pv.product,\n productversion=pv,\n name=\"PassCase\",\n )\n\n self.factory.create(caseversion=c_p, run=r1)\n\n # submit results for these cases\n payload = {\n \"objects\": [\n {\n \"case\": c_p.case.id,\n \"environment\": envs[0].id,\n \"run_id\": r1.id,\n \"status\": \"passed\"\n }\n ]\n }\n\n res = self.patch(\n self.get_list_url(self.resource_name),\n payload=payload,\n status=401,\n )", "metadata": "root.ResultResourceTest.test_submit_results_for_run_no_authentication", "header": "['class', 'ResultResourceTest', '(', 'case', '.', 'api', '.', 'ApiTestCase', ')', ':', '___EOS___']", "index": 260 }, { "content": " def test_submit_results_for_run_no_authorization(self):\n \"\"\"Submit results for an existing test run by user without perms.\"\"\"\n user = self.F.UserFactory.create(\n username=\"foo\",\n )\n apikey = self.F.ApiKeyFactory.create(owner=user)\n envs = self.F.EnvironmentFactory.create_full_set(\n {\"OS\": [\"OS X\", \"Linux\"]})\n pv = self.F.ProductVersionFactory.create(environments=envs)\n r1 = self.F.RunFactory.create(name=\"RunA\", productversion=pv)\n\n c_p = self.F.CaseVersionFactory.create(\n case__product=pv.product,\n productversion=pv,\n name=\"PassCase\",\n )\n\n self.factory.create(caseversion=c_p, run=r1)\n\n # submit results for these cases\n params = {\"username\": user.username, \"api_key\": apikey.key}\n payload = {\n \"objects\": [\n {\n \"case\": c_p.case.id,\n \"environment\": envs[0].id,\n \"run_id\": r1.id,\n \"status\": \"passed\"\n }\n ]\n }\n\n res = self.patch(\n self.get_list_url(self.resource_name),\n payload=payload,\n params=params,\n status=401,\n )", "metadata": "root.ResultResourceTest.test_submit_results_for_run_no_authorization", "header": "['class', 'ResultResourceTest', '(', 'case', '.', 'api', '.', 'ApiTestCase', ')', ':', '___EOS___']", "index": 294 } ]
[ { "span": "res ", "start_line": 113, "start_column": 8, "end_line": 113, "end_column": 11 }, { "span": "res ", "start_line": 172, "start_column": 8, "end_line": 172, "end_column": 11 }, { "span": "res ", "start_line": 213, "start_column": 8, "end_line": 213, "end_column": 11 }, { "span": "res ", "start_line": 252, "start_column": 8, "end_line": 252, "end_column": 11 }, { "span": "res ", "start_line": 287, "start_column": 8, "end_line": 287, "end_column": 11 }, { "span": "res ", "start_line": 326, "start_column": 8, "end_line": 326, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Result", "Reso", "urc", "e", "Test_", "(_", "case_", "._", "api_", "._", "Ap", "i", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "submit", "\\u", "results", "\\u", "for", "\\u", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Submit", " ", "results", " ", "for", " ", "an", " ", "exist", "ing", " ", "test", " ", "run", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "self_", "._", "F_", "._", "User", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "\"", "foo", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissions_", "=_", "[_", "\"", "executi", "on", ".", "execute", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apikey_", "=_", "self_", "._", "F_", "._", "Ap", "i", "Key", "Factory_", "._", "create_", "(_", "owner_", "=_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "envs_", "=_", "self_", "._", "F_", "._", "Environ", "ment", "Factory_", "._", "create", "\\u", "full", "\\u", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "OS", "\"_", ":_", "[_", "\"", "OS", " ", "X", "\"_", ",_", "\"", "Lin", "ux", "\"_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv_", "=_", "self_", "._", "F_", "._", "Product", "Version", "Factory_", "._", "create_", "(_", "environments_", "=_", "envs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r1_", "=_", "self_", "._", "F_", "._", "Run", "Factory_", "._", "create_", "(_", "name_", "=_", "\"", "Run", "A", "\"_", ",_", "product", "version_", "=_", "pv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "p_", "=_", "self_", "._", "F_", "._", "Case", "Version", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u\\u", "product_", "=_", "pv_", "._", "product_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "product", "version_", "=_", "pv_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "Pass", "Case", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "i_", "=_", "self_", "._", "F_", "._", "Case", "Version", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u\\u", "product_", "=_", "pv_", "._", "product_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "product", "version_", "=_", "pv_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "Inva", "lid", "Case", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "f_", "=_", "self_", "._", "F_", "._", "Case", "Version", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u\\u", "product_", "=_", "pv_", "._", "product_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "product", "version_", "=_", "pv_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "Fail", "Case", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "b_", "=_", "self_", "._", "F_", "._", "Case", "Version", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u\\u", "product_", "=_", "pv_", "._", "product_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "product", "version_", "=_", "pv_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "Block", "Case", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "s_", "=_", "self_", "._", "F_", "._", "Case", "Version", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u\\u", "product_", "=_", "pv_", "._", "product_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "product", "version_", "=_", "pv_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "Ski", "p", "Case", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "F_", "._", "Case", "Step", "Factory_", "(_", "case", "version_", "=_", "c\\u", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "factory_", "._", "create_", "(_", "case", "version_", "=_", "c\\u", "p_", ",_", "run_", "=_", "r1_", ",_", "environments_", "=_", "envs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "factory_", "._", "create_", "(_", "case", "version_", "=_", "c\\u", "i_", ",_", "run_", "=_", "r1_", ",_", "environments_", "=_", "envs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "factory_", "._", "create_", "(_", "case", "version_", "=_", "c\\u", "f_", ",_", "run_", "=_", "r1_", ",_", "environments_", "=_", "envs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "factory_", "._", "create_", "(_", "case", "version_", "=_", "c\\u", "b_", ",_", "run_", "=_", "r1_", ",_", "environments_", "=_", "envs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "factory_", "._", "create_", "(_", "case", "version_", "=_", "c\\u", "s_", ",_", "run_", "=_", "r1_", ",_", "environments_", "=_", "envs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "submit", " ", "results", " ", "for", " ", "these", " ", "cases_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "\"", "user", "name", "\"_", ":_", "user_", "._", "username_", ",_", "\"", "api", "\\u", "key", "\"_", ":_", "apikey_", "._", "key_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "s", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "case", "\"_", ":_", "c\\u", "p_", "._", "case_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "environ", "ment", "\"_", ":_", "envs_", "[_", "0_", "]_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "run", "\\u", "id", "\"_", ":_", "r1_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "status", "\"_", ":_", "\"", "pass", "ed", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "case", "\"_", ":_", "c\\u", "s_", "._", "case_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "environ", "ment", "\"_", ":_", "envs_", "[_", "0_", "]_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "run", "\\u", "id", "\"_", ":_", "r1_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "status", "\"_", ":_", "\"", "skip", "ped", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "case", "\"_", ":_", "c\\u", "i_", "._", "case_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "comment", "\"_", ":_", "\"", "wh", "y", " ", "u", " ", "no", " ", "make", " ", "sense", "??", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "environ", "ment", "\"_", ":_", "envs_", "[_", "0_", "]_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "run", "\\u", "id", "\"_", ":_", "r1_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "status", "\"_", ":_", "\"", "invalidate", "d", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "case", "\"_", ":_", "c\\u", "b_", "._", "case_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "comment", "\"_", ":_", "\"", "wh", "y", " ", "u", " ", "no", " ", "run", "??", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "environ", "ment", "\"_", ":_", "envs_", "[_", "0_", "]_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "run", "\\u", "id", "\"_", ":_", "r1_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "status", "\"_", ":_", "\"", "block", "ed", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bug", "\"_", ":_", "\"", "http", "://", "www", ".", "death", "vall", "ey", "dog", "s", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "case", "\"_", ":_", "c\\u", "f_", "._", "case_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "comment", "\"_", ":_", "\"", "wh", "y", " ", "u", " ", "no", " ", "pass", "?\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "environ", "ment", "\"_", ":_", "envs_", "[_", "0_", "]_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "run", "\\u", "id", "\"_", ":_", "r1_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "status", "\"_", ":_", "\"", "fail", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "step", "number", "\"_", ":_", "1_", "\\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_", "res_", "=_", "self_", "._", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "list", "\\u", "url_", "(_", "self_", "._", "resource", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "payload_", "=_", "payload_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "assert", " ", "Fal", "se", ",", " ", "res", ".", "text_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify", " ", "pass", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "self_", "._", "model_", "._", "Result_", "._", "objects_", "._", "get_", "(_", "runc", "ase", "version", "\\u\\u", "case", "version_", "=_", "c\\u", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "status_", ",_", "\"", "pass", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "environment_", ",_", "envs_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify", " ", "fail", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "self_", "._", "model_", "._", "Result_", "._", "objects_", "._", "get_", "(_", "runc", "ase", "version", "\\u\\u", "case", "version_", "=_", "c\\u", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "status_", ",_", "\"", "fail", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "comment_", ",_", "\"", "wh", "y", " ", "u", " ", "no", " ", "pass", "?\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "set_", "(_", "result_", "._", "bug", "\\u", "urls_", "(_", ")_", ")_", ",_", "set_", "(_", "[_", "\"", "http", "://", "www", ".", "death", "vall", "ey", "dog", "s", ".", "com", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "environment_", ",_", "envs_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify", " ", "invalid", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "self_", "._", "model_", "._", "Result_", "._", "objects_", "._", "get_", "(_", "runc", "ase", "version", "\\u\\u", "case", "version_", "=_", "c\\u", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "status_", ",_", "\"", "invalidate", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "environment_", ",_", "envs_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "comment_", ",_", "\"", "wh", "y", " ", "u", " ", "no", " ", "make", " ", "sense", "??", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "Reso", "urc", "e", "Test_", "(_", "case_", "._", "api_", "._", "Ap", "i", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "submit", "\\u", "results", "\\u", "for", "\\u", "run", "\\u", "no", "\\u", "status_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Submit", " ", "results", " ", "for", " ", "an", " ", "exist", "ing", " ", "test", " ", "run", " ", "with", "out", " ", "a", " ", "status", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "self_", "._", "F_", "._", "User", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "\"", "foo", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissions_", "=_", "[_", "\"", "executi", "on", ".", "execute", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apikey_", "=_", "self_", "._", "F_", "._", "Ap", "i", "Key", "Factory_", "._", "create_", "(_", "owner_", "=_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "envs_", "=_", "self_", "._", "F_", "._", "Environ", "ment", "Factory_", "._", "create", "\\u", "full", "\\u", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "OS", "\"_", ":_", "[_", "\"", "OS", " ", "X", "\"_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv_", "=_", "self_", "._", "F_", "._", "Product", "Version", "Factory_", "._", "create_", "(_", "environments_", "=_", "envs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r1_", "=_", "self_", "._", "F_", "._", "Run", "Factory_", "._", "create_", "(_", "name_", "=_", "\"", "Run", "A", "\"_", ",_", "product", "version_", "=_", "pv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "p_", "=_", "self_", "._", "F_", "._", "Case", "Version", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u\\u", "product_", "=_", "pv_", "._", "product_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "product", "version_", "=_", "pv_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "Pass", "Case", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "factory_", "._", "create_", "(_", "case", "version_", "=_", "c\\u", "p_", ",_", "run_", "=_", "r1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "submit", " ", "results", " ", "for", " ", "these", " ", "cases_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "\"", "user", "name", "\"_", ":_", "user_", "._", "username_", ",_", "\"", "api", "\\u", "key", "\"_", ":_", "apikey_", "._", "key_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "s", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "case", "\"_", ":_", "c\\u", "p_", "._", "case_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "environ", "ment", "\"_", ":_", "envs_", "[_", "0_", "]_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "run", "\\u", "id", "\"_", ":_", "r1_", "._", "id_", ",_", "\\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_", "res_", "=_", "self_", "._", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "list", "\\u", "url_", "(_", "self_", "._", "resource", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "payload_", "=_", "payload_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "400_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "Reso", "urc", "e", "Test_", "(_", "case_", "._", "api_", "._", "Ap", "i", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "submit", "\\u", "results", "\\u", "for", "\\u", "run", "\\u", "bad", "\\u", "env", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Submit", " ", "results", " ", "for", " ", "an", " ", "exist", "ing", " ", "test", " ", "run", " ", "with", " ", "a", " ", "bad", " ", "env", " ", "id", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "self_", "._", "F_", "._", "User", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "\"", "foo", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissions_", "=_", "[_", "\"", "executi", "on", ".", "execute", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apikey_", "=_", "self_", "._", "F_", "._", "Ap", "i", "Key", "Factory_", "._", "create_", "(_", "owner_", "=_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "envs_", "=_", "self_", "._", "F_", "._", "Environ", "ment", "Factory_", "._", "create", "\\u", "full", "\\u", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "OS", "\"_", ":_", "[_", "\"", "OS", " ", "X", "\"_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv_", "=_", "self_", "._", "F_", "._", "Product", "Version", "Factory_", "._", "create_", "(_", "environments_", "=_", "envs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r1_", "=_", "self_", "._", "F_", "._", "Run", "Factory_", "._", "create_", "(_", "name_", "=_", "\"", "Run", "A", "\"_", ",_", "product", "version_", "=_", "pv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "p_", "=_", "self_", "._", "F_", "._", "Case", "Version", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u\\u", "product_", "=_", "pv_", "._", "product_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "product", "version_", "=_", "pv_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "Pass", "Case", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "factory_", "._", "create_", "(_", "case", "version_", "=_", "c\\u", "p_", ",_", "run_", "=_", "r1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "submit", " ", "results", " ", "for", " ", "these", " ", "cases_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "\"", "user", "name", "\"_", ":_", "user_", "._", "username_", ",_", "\"", "api", "\\u", "key", "\"_", ":_", "apikey_", "._", "key_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "s", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "case", "\"_", ":_", "c\\u", "p_", "._", "case_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "environ", "ment", "\"_", ":_", "envs_", "[_", "0_", "]_", "._", "id_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "run", "\\u", "id", "\"_", ":_", "r1_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "status", "\"_", ":_", "\"", "pass", "ed", "\"_", ",_", "\\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_", "res_", "=_", "self_", "._", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "list", "\\u", "url_", "(_", "self_", "._", "resource", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "payload_", "=_", "payload_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "400_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "Reso", "urc", "e", "Test_", "(_", "case_", "._", "api_", "._", "Ap", "i", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "submit", "\\u", "results", "\\u", "for", "\\u", "run", "\\u", "no", "\\u", "runc", "ase", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Submit", " ", "results", " ", "for", " ", "an", " ", "exist", "ing", " ", "test", " ", "run", " ", "whe", "n", " ", "a", " ", "runc", "ase", "version", " ", "doe", "sn", "'", "t", " ", "exist", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "self_", "._", "F_", "._", "User", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "\"", "foo", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "permissions_", "=_", "[_", "\"", "executi", "on", ".", "execute", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apikey_", "=_", "self_", "._", "F_", "._", "Ap", "i", "Key", "Factory_", "._", "create_", "(_", "owner_", "=_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "envs_", "=_", "self_", "._", "F_", "._", "Environ", "ment", "Factory_", "._", "create", "\\u", "full", "\\u", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "OS", "\"_", ":_", "[_", "\"", "OS", " ", "X", "\"_", ",_", "\"", "Lin", "ux", "\"_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv_", "=_", "self_", "._", "F_", "._", "Product", "Version", "Factory_", "._", "create_", "(_", "environments_", "=_", "envs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r1_", "=_", "self_", "._", "F_", "._", "Run", "Factory_", "._", "create_", "(_", "name_", "=_", "\"", "Run", "A", "\"_", ",_", "product", "version_", "=_", "pv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "p_", "=_", "self_", "._", "F_", "._", "Case", "Version", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u\\u", "product_", "=_", "pv_", "._", "product_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "product", "version_", "=_", "pv_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "Pass", "Case", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "submit", " ", "results", " ", "for", " ", "these", " ", "cases_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "\"", "user", "name", "\"_", ":_", "user_", "._", "username_", ",_", "\"", "api", "\\u", "key", "\"_", ":_", "apikey_", "._", "key_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "s", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "case", "\"_", ":_", "c\\u", "p_", "._", "case_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "environ", "ment", "\"_", ":_", "envs_", "[_", "0_", "]_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "run", "\\u", "id", "\"_", ":_", "r1_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "status", "\"_", ":_", "\"", "pass", "ed", "\"_", "\\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_", "res_", "=_", "self_", "._", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "list", "\\u", "url_", "(_", "self_", "._", "resource", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "payload_", "=_", "payload_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "400_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "Reso", "urc", "e", "Test_", "(_", "case_", "._", "api_", "._", "Ap", "i", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "submit", "\\u", "results", "\\u", "for", "\\u", "run", "\\u", "no", "\\u", "authentication_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Submit", " ", "results", " ", "for", " ", "an", " ", "exist", "ing", " ", "test", " ", "run", " ", "by", " ", "non", "-", "user", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "envs_", "=_", "self_", "._", "F_", "._", "Environ", "ment", "Factory_", "._", "create", "\\u", "full", "\\u", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "OS", "\"_", ":_", "[_", "\"", "OS", " ", "X", "\"_", ",_", "\"", "Lin", "ux", "\"_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv_", "=_", "self_", "._", "F_", "._", "Product", "Version", "Factory_", "._", "create_", "(_", "environments_", "=_", "envs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r1_", "=_", "self_", "._", "F_", "._", "Run", "Factory_", "._", "create_", "(_", "name_", "=_", "\"", "Run", "A", "\"_", ",_", "product", "version_", "=_", "pv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "p_", "=_", "self_", "._", "F_", "._", "Case", "Version", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u\\u", "product_", "=_", "pv_", "._", "product_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "product", "version_", "=_", "pv_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "Pass", "Case", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "factory_", "._", "create_", "(_", "case", "version_", "=_", "c\\u", "p_", ",_", "run_", "=_", "r1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "submit", " ", "results", " ", "for", " ", "these", " ", "cases_", "\\u\\u\\uNL\\u\\u\\u_", "payload_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "s", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "case", "\"_", ":_", "c\\u", "p_", "._", "case_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "environ", "ment", "\"_", ":_", "envs_", "[_", "0_", "]_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "run", "\\u", "id", "\"_", ":_", "r1_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "status", "\"_", ":_", "\"", "pass", "ed", "\"_", "\\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_", "res_", "=_", "self_", "._", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "list", "\\u", "url_", "(_", "self_", "._", "resource", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "payload_", "=_", "payload_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "401_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "Reso", "urc", "e", "Test_", "(_", "case_", "._", "api_", "._", "Ap", "i", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "submit", "\\u", "results", "\\u", "for", "\\u", "run", "\\u", "no", "\\u", "authorization_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Submit", " ", "results", " ", "for", " ", "an", " ", "exist", "ing", " ", "test", " ", "run", " ", "by", " ", "user", " ", "with", "out", " ", "perm", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "self_", "._", "F_", "._", "User", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "\"", "foo", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apikey_", "=_", "self_", "._", "F_", "._", "Ap", "i", "Key", "Factory_", "._", "create_", "(_", "owner_", "=_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "envs_", "=_", "self_", "._", "F_", "._", "Environ", "ment", "Factory_", "._", "create", "\\u", "full", "\\u", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "OS", "\"_", ":_", "[_", "\"", "OS", " ", "X", "\"_", ",_", "\"", "Lin", "ux", "\"_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv_", "=_", "self_", "._", "F_", "._", "Product", "Version", "Factory_", "._", "create_", "(_", "environments_", "=_", "envs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r1_", "=_", "self_", "._", "F_", "._", "Run", "Factory_", "._", "create_", "(_", "name_", "=_", "\"", "Run", "A", "\"_", ",_", "product", "version_", "=_", "pv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "p_", "=_", "self_", "._", "F_", "._", "Case", "Version", "Factory_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u\\u", "product_", "=_", "pv_", "._", "product_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "product", "version_", "=_", "pv_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "Pass", "Case", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "factory_", "._", "create_", "(_", "case", "version_", "=_", "c\\u", "p_", ",_", "run_", "=_", "r1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "submit", " ", "results", " ", "for", " ", "these", " ", "cases_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "\"", "user", "name", "\"_", ":_", "user_", "._", "username_", ",_", "\"", "api", "\\u", "key", "\"_", ":_", "apikey_", "._", "key_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "s", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "case", "\"_", ":_", "c\\u", "p_", "._", "case_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "environ", "ment", "\"_", ":_", "envs_", "[_", "0_", "]_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "run", "\\u", "id", "\"_", ":_", "r1_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "status", "\"_", ":_", "\"", "pass", "ed", "\"_", "\\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_", "res_", "=_", "self_", "._", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "list", "\\u", "url_", "(_", "self_", "._", "resource", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "payload_", "=_", "payload_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "401_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Except block handles 'BaseException'
shinymud/ShinyMUD/src/shinymud/models/room_exit.py
[ { "content": " def _resolve_to_room(self):\n if getattr(self, '_to_room', None):\n return self._to_room\n try:\n self.to_room = self.world.get_area(str(self.to_area)).get_room(str(self.to_room_id))\n return self._to_room\n except:\n return None", "metadata": "root.RoomExit._resolve_to_room", "header": "['class', 'RoomExit', '(', 'Model', ')', ':', '___EOS___']", "index": 50 }, { "content": " def _resolve_key(self):\n if getattr(self, '_key', None):\n return self._key\n if self.key_area and self.key_id:\n try: \n self.key = self.world.get_area(self.key_area).get_item(self.key_id)\n return self._key\n except:\n pass\n return None", "metadata": "root.RoomExit._resolve_key", "header": "['class', 'RoomExit', '(', 'Model', ')', ':', '___EOS___']", "index": 67 } ]
[ { "span": "except:", "start_line": 56, "start_column": 8, "end_line": 56, "end_column": 15 }, { "span": "except:", "start_line": 74, "start_column": 12, "end_line": 74, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Room", "Exit_", "(_", "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_", "\\u", "resolve", "\\u", "to", "\\u", "room_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "getattr_", "(_", "self_", ",_", "'\\u", "to", "\\u", "room", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "to", "\\u", "room_", "\\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_", "._", "to", "\\u", "room_", "=_", "self_", "._", "world_", "._", "get", "\\u", "area_", "(_", "str_", "(_", "self_", "._", "to", "\\u", "area_", ")_", ")_", "._", "get", "\\u", "room_", "(_", "str_", "(_", "self_", "._", "to", "\\u", "room", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "to", "\\u", "room_", "\\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_", "Room", "Exit_", "(_", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "resolve", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "getattr_", "(_", "self_", ",_", "'\\u", "key", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "key", "\\u", "area_", "and_", "self_", "._", "key", "\\u", "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 ", " _", "self_", "._", "key_", "=_", "self_", "._", "world_", "._", "get", "\\u", "area_", "(_", "self_", "._", "key", "\\u", "area_", ")_", "._", "get", "\\u", "item_", "(_", "self_", "._", "key", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Module is imported more than once
amrdraz/kodr/app/brython/www/src/Lib/test/test_platform.py
[ { "content": "import os\nimport platform\nimport subprocess\nimport sys\nimport unittest\nimport warnings\n\nfrom test import support\n\n\n\n\nif __name__ == '__main__':\n test_main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def test_libc_ver(self):\n import os\n if os.path.isdir(sys.executable) and \\\n os.path.exists(sys.executable+'.exe'):\n # Cygwin horror\n executable = sys.executable + '.exe'\n else:\n executable = sys.executable\n res = platform.libc_ver(executable)", "metadata": "root.PlatformTest.test_libc_ver", "header": "['class', 'PlatformTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 238 } ]
[ { "span": "import os", "start_line": 239, "start_column": 8, "end_line": 239, "end_column": 17 } ]
[ { "span": "import os", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 9 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "test_", "import_", "support_", "\\u\\u\\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_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "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", "libc", "\\u", "ver_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "sys_", "._", "executable_", ")_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "sys_", "._", "executable_", "+_", "'.", "exe", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Cy", "gw", "in", " ", "hor", "ror_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "executable_", "=_", "sys_", "._", "executable_", "+_", "'.", "exe", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "executable_", "=_", "sys_", "._", "executable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "platform_", "._", "libc", "\\u", "ver_", "(_", "executable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
saltstack/salt/salt/modules/win_repo.py
[ { "content": "# -*- coding: utf-8 -*-\nr'''\nModule to manage Windows software repo on a Standalone Minion\n\n``file_client: local`` must be set in the minion config file.\n\nFor documentation on Salt's Windows Repo feature, see :ref:`here\n<windows-package-manager>`.\n'''\n\n# Import python libs\nfrom __future__ import absolute_import, print_function\nimport logging\nimport os\n\n# Import salt libs\nimport salt.output\nimport salt.utils\nimport salt.loader\nimport salt.template\nfrom salt.exceptions import CommandExecutionError, SaltRenderError\n\n# All the \"unused\" imports here are needed for the imported winrepo runner code\n# pylint: disable=unused-import\nfrom salt.runners.winrepo import (\n genrepo as _genrepo,\n update_git_repos as _update_git_repos,\n PER_REMOTE_OVERRIDES\n)\nfrom salt.ext import six\ntry:\n import msgpack\nexcept ImportError:\n import msgpack_pure as msgpack # pylint: disable=import-error\nimport salt.utils.gitfs\n# pylint: enable=unused-import\n\nlog = logging.getLogger(__name__)\n\n# Define the module's virtual name\n__virtualname__ = 'winrepo'\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def __virtual__():\n '''\n Set the winrepo module if the OS is Windows\n '''\n if salt.utils.is_windows():\n global _genrepo, _update_git_repos\n _genrepo = salt.utils.namespaced_function(_genrepo, globals())\n _update_git_repos = \\\n salt.utils.namespaced_function(_update_git_repos, globals())\n return __virtualname__\n return (False, 'This module only works on Windows.')", "metadata": "root.__virtual__", "header": "['module', '___EOS___']", "index": 43 }, { "content": "def _get_local_repo_dir(saltenv='base'):\n if 'win_repo_source_dir' in __opts__:\n salt.utils.warn_until(\n 'Nitrogen',\n 'The \\'win_repo_source_dir\\' config option is deprecated, please '\n 'use \\'winrepo_source_dir\\' instead.'\n )\n winrepo_source_dir = __opts__['win_repo_source_dir']\n else:\n winrepo_source_dir = __opts__['winrepo_source_dir']\n\n dirs = []\n dirs.append(salt.syspaths.CACHE_DIR)\n dirs.extend(['minion', 'files'])\n dirs.append(saltenv)\n dirs.extend(winrepo_source_dir[7:].strip('/').split('/'))\n return os.sep.join(dirs)", "metadata": "root._get_local_repo_dir", "header": "['module', '___EOS___']", "index": 56 }, { "content": "def genrepo():\n r'''\n Generate winrepo_cachefile based on sls files in the winrepo_dir\n\n CLI Example:\n\n .. code-block:: bash\n\n salt-call winrepo.genrepo\n '''\n return _genrepo(opts=__opts__, fire_event=False)", "metadata": "root.genrepo", "header": "['module', '___EOS___']", "index": 75 }, { "content": "def update_git_repos(clean=False):\n '''\n Checkout git repos containing :ref:`Windows Software Package Definitions\n <windows-package-manager>`.\n\n .. important::\n This function requires `Git for Windows`_ to be installed in order to\n work. When installing, make sure to select an installation option which\n permits the git executable to be run from the Command Prompt.\n\n .. _`Git for Windows`: https://git-for-windows.github.io/\n\n clean : False\n Clean repo cachedirs which are not configured under\n :conf_minion:`winrepo_remotes`.\n\n .. note::\n This option only applies if either pygit2_ or GitPython_ is\n installed into Salt's bundled Python.\n\n .. warning::\n This argument should not be set to ``True`` if a mix of git and\n non-git repo definitions are being used, as it will result in the\n non-git repo definitions being removed.\n\n .. versionadded:: 2015.8.0\n\n .. _GitPython: https://github.com/gitpython-developers/GitPython\n .. _pygit2: https://github.com/libgit2/pygit2\n\n CLI Example:\n\n .. code-block:: bash\n\n salt-call winrepo.update_git_repos\n '''\n if not salt.utils.which('git'):\n raise CommandExecutionError(\n 'Git for Windows is not installed, or not configured to be '\n 'accessible from the Command Prompt'\n )\n return _update_git_repos(opts=__opts__, clean=clean, masterless=True)", "metadata": "root.update_git_repos", "header": "['module', '___EOS___']", "index": 88 }, { "content": "def show_sls(name, saltenv='base'):\n '''\n .. versionadded:: 2015.8.0\n\n Display the rendered software definition from a specific sls file in the\n local winrepo cache. This will parse all Jinja. Run pkg.refresh_db to pull\n the latest software definitions from the master.\n\n\n :param str name:\n The name of the package you want to view. Start from the local winrepo\n root. If you have ``.sls`` files organized in subdirectories you'll have\n to denote them with ``.``. For example, if I have a ``test`` directory\n in the winrepo root with a ``gvim.sls`` file inside, I would target that\n file like so: ``test.gvim``. Directories can be targeted as well as long\n as they contain an ``init.sls`` inside. For example, if I have a ``node``\n directory with an ``init.sls`` inside, I would target that like so:\n ``node``.\n\n :param str saltenv:\n The default environment is ``base``\n\n :return:\n Returns a dictionary containing the rendered data structure\n :rtype: dict\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' winrepo.show_sls gvim\n salt '*' winrepo.show_sls test.npp\n '''\n # Get the location of the local repo\n repo = _get_local_repo_dir(saltenv)\n\n # Add the sls file name to the path\n repo = repo.split('\\\\')\n definition = name.split('.')\n repo.extend(definition)\n\n # Check for the sls file by name\n sls_file = '{0}.sls'.format(os.sep.join(repo))\n if not os.path.exists(sls_file):\n\n # Maybe it's a directory with an init.sls\n sls_file = '{0}\\\\init.sls'.format(os.sep.join(repo))\n if not os.path.exists(sls_file):\n\n # It's neither, return\n return 'Software definition {0} not found'.format(name)\n\n # Load the renderer\n renderers = salt.loader.render(__opts__, __salt__)\n config = {}\n\n # Run the file through the renderer\n try:\n config = salt.template.compile_template(\n sls_file,\n renderers,\n __opts__['renderer'])\n\n # Dump return the error if any\n except SaltRenderError as exc:\n log.debug('Failed to compile {0}.'.format(sls_file))\n log.debug('Error: {0}.'.format(exc))\n config['Message'] = 'Failed to compile {0}'.format(sls_file)\n config['Error'] = '{0}'.format(exc)\n\n return config", "metadata": "root.show_sls", "header": "['module', '___EOS___']", "index": 132 } ]
[ { "span": "from salt.runners.winrepo import (\n genrepo as _genrepo,\n update_git_repos as _update_git_repos,\n PER_REMOTE_OVERRIDES\n)", "start_line": 24, "start_column": 0, "end_line": 28, "end_column": 1 }, { "span": "from salt.ext import six", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 24 }, { "span": "import msgpack", "start_line": 31, "start_column": 4, "end_line": 31, "end_column": 18 }, { "span": "import msgpack_pure as msgpack ", "start_line": 33, "start_column": 4, "end_line": 33, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'''", "\\", "10", ";", "Modul", "e", " ", "to", " ", "manage", " ", "Window", "s", " ", "software", " ", "repo", " ", "on", " ", "a", " ", "Stand", "alo", "ne", " ", "Mini", "on", "\\", "10", ";", "\\", "10", ";", "``", "file", "\\u", "client", ":", " ", "local", "``", " ", "must", " ", "be", " ", "set", " ", "in", " ", "the", " ", "minion", " ", "config", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", "For", " ", "documentation", " ", "on", " ", "Sal", "t", "'", "s", " ", "Window", "s", " ", "Rep", "o", " ", "feature", ",", " ", "see", " ", ":", "ref", ":`", "here", "\\", "10", ";<", "windows", "-", "package", "-", "manage", "r", ">`", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "python", " ", "libs_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "salt", " ", "libs_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "salt_", "._", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "salt_", "._", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "salt_", "._", "loader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "salt_", "._", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "salt_", "._", "exceptions_", "import_", "Command", "Execut", "ion", "Error_", ",_", "Sal", "t", "Render", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "the", " ", "\"", "unu", "sed", "\"", " ", "import", "s", " ", "here", " ", "are", " ", "need", "ed", " ", "for", " ", "the", " ", "import", "ed", " ", "winr", "epo", " ", "runn", "er", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "unu", "sed", "-", "import_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "salt_", "._", "runners", "_", "._", "winr", "epo", "_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "genr", "epo", "_", "as_", "\\u", "genr", "epo", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "\\u", "git", "\\u", "repos_", "as_", "\\u", "update", "\\u", "git", "\\u", "repos_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "PER", "\\u", "REMO", "TE", "\\u", "OVERRIDE", "S_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "salt_", "._", "ext_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "msgpack", "_", "\\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_", "msgpack", "\\u", "pure", "_", "as_", "msgpack", "_", "#", " ", "pylint", ":", " ", "disable", "=", "import", "-", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "salt_", "._", "utils_", "._", "git", "fs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "enable", "=", "unu", "sed", "-", "import_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", " ", "the", " ", "module", "'", "s", " ", "virtual", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "virtual", "name\\u\\u_", "=_", "'", "winr", "epo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\u", "virtual", "\\u\\u_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "the", " ", "winr", "epo", " ", "module", " ", "if", " ", "the", " ", "OS", " ", "is", " ", "Window", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "salt_", "._", "utils_", "._", "is", "\\u", "windows_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "\\u", "genr", "epo", "_", ",_", "\\u", "update", "\\u", "git", "\\u", "repos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "genr", "epo", "_", "=_", "salt_", "._", "utils_", "._", "namespace", "d\\u", "function_", "(_", "\\u", "genr", "epo", "_", ",_", "globals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "update", "\\u", "git", "\\u", "repos_", "=_", "salt_", "._", "utils_", "._", "namespace", "d\\u", "function_", "(_", "\\u", "update", "\\u", "git", "\\u", "repos_", ",_", "globals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u", "virtual", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "False_", ",_", "'", "Thi", "s", " ", "module", " ", "only", " ", "works", " ", "on", " ", "Window", "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_", "\\u", "get", "\\u", "local", "\\u", "repo", "\\u", "dir_", "(_", "salt", "env_", "=_", "'", "base", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "win", "\\u", "repo", "\\u", "source", "\\u", "dir", "'_", "in_", "\\u\\u", "opts", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "salt_", "._", "utils_", "._", "warn", "\\u", "until_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ni", "tro", "gen", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "\\\\'", "win", "\\u", "repo", "\\u", "source", "\\u", "dir", "\\\\'", " ", "config", " ", "option", " ", "is", " ", "depre", "cated", ",", " ", "plea", "se", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "use", " ", "\\\\'", "winr", "epo", "\\u", "source", "\\u", "dir", "\\\\'", " ", "inst", "ead", ".'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "winr", "epo", "\\u", "source", "\\u", "dir_", "=_", "\\u\\u", "opts", "\\u\\u_", "[_", "'", "win", "\\u", "repo", "\\u", "source", "\\u", "dir", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "winr", "epo", "\\u", "source", "\\u", "dir_", "=_", "\\u\\u", "opts", "\\u\\u_", "[_", "'", "winr", "epo", "\\u", "source", "\\u", "dir", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dirs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dirs_", "._", "append_", "(_", "salt_", "._", "sysp", "ath", "s_", "._", "CACHE", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dirs_", "._", "extend_", "(_", "[_", "'", "minion", "'_", ",_", "'", "files", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dirs_", "._", "append_", "(_", "salt", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dirs_", "._", "extend_", "(_", "winr", "epo", "\\u", "source", "\\u", "dir_", "[_", "7_", ":_", "]_", "._", "strip_", "(_", "'/'_", ")_", "._", "split_", "(_", "'/'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "os_", "._", "sep_", "._", "join_", "(_", "dirs_", ")_", "\\u\\u\\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_", "genr", "epo", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "'''", "\\", "10", ";", " ", " ", " ", " ", "Generate", " ", "winr", "epo", "\\u", "cache", "file", " ", "based", " ", "on", " ", "sl", "s", " ", "files", " ", "in", " ", "the", " ", "winr", "epo", "\\u", "dir", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", "-", "call", " ", "winr", "epo", ".", "genr", "epo", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "genr", "epo", "_", "(_", "opts_", "=_", "\\u\\u", "opts", "\\u\\u_", ",_", "fire", "\\u", "event_", "=_", "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_", "update", "\\u", "git", "\\u", "repos_", "(_", "clean_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Check", "out", " ", "git", " ", "repos", " ", "contain", "ing", " ", ":", "ref", ":`", "Window", "s", " ", "Sof", "twa", "re", " ", "Packa", "ge", " ", "Definit", "ion", "s", "\\", "10", ";", " ", " ", " ", " ", "<", "windows", "-", "package", "-", "manage", "r", ">`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "importa", "nt", "::", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "require", "s", " ", "`", "Git", " ", "for", " ", "Window", "s", "`\\u", " ", "to", " ", "be", " ", "install", "ed", " ", "in", " ", "order", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "work", ".", " ", "Whe", "n", " ", "install", "ing", ",", " ", "make", " ", "sure", " ", "to", " ", "select", " ", "an", " ", "installation", " ", "option", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "permit", "s", " ", "the", " ", "git", " ", "executable", " ", "to", " ", "be", " ", "run", " ", "from", " ", "the", " ", "Command", " ", "Prom", "pt", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "\\u`", "Git", " ", "for", " ", "Window", "s", "`", ":", " ", "https", "://", "git", "-", "for", "-", "windows", ".", "git", "hub", ".", "io", "/", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "clean", " ", ":", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "Clean", " ", "repo", " ", "cachedir", "s", " ", "whi", "ch", " ", "are", " ", "not", " ", "configur", "ed", " ", "under", "\\", "10", ";", " ", " ", " ", " ", ":", "conf", "\\u", "minion", ":`", "winr", "epo", "\\u", "remotes", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "option", " ", "only", " ", "appli", "es", " ", "if", " ", "eit", "her", " ", "pyg", "it", "2", "\\u", " ", "or", " ", "Git", "Pyth", "on", "\\u", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "install", "ed", " ", "int", "o", " ", "Sal", "t", "'", "s", " ", "bundle", "d", " ", "Pyth", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "warn", "ing", "::", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "argu", "ment", " ", "shou", "ld", " ", "not", " ", "be", " ", "set", " ", "to", " ", "``", "Tru", "e", "``", " ", "if", " ", "a", " ", "mix", " ", "of", " ", "git", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "non", "-", "git", " ", "repo", " ", "definit", "ion", "s", " ", "are", " ", "bei", "ng", " ", "used", ",", " ", "as", " ", "it", " ", "will", " ", "result", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "non", "-", "git", " ", "repo", " ", "definit", "ion", "s", " ", "bei", "ng", " ", "remove", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "201", "5.8", ".0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "\\u", "Git", "Pyth", "on", ":", " ", "https", "://", "git", "hub", ".", "com", "/", "git", "python", "-", "developer", "s", "/", "Git", "Pyth", "on", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "\\u", "pyg", "it", "2", ":", " ", "https", "://", "git", "hub", ".", "com", "/", "libg", "it", "2", "/", "pyg", "it", "2", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", "-", "call", " ", "winr", "epo", ".", "update", "\\u", "git", "\\u", "repos", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "salt_", "._", "utils_", "._", "which_", "(_", "'", "git", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Execut", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Git", " ", "for", " ", "Window", "s", " ", "is", " ", "not", " ", "install", "ed", ",", " ", "or", " ", "not", " ", "configur", "ed", " ", "to", " ", "be", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "accessible", " ", "from", " ", "the", " ", "Command", " ", "Prom", "pt", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "update", "\\u", "git", "\\u", "repos_", "(_", "opts_", "=_", "\\u\\u", "opts", "\\u\\u_", ",_", "clean_", "=_", "clean_", ",_", "master", "less_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "\\u", "sl", "s_", "(_", "name_", ",_", "salt", "env_", "=_", "'", "base", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "201", "5.8", ".0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Display", " ", "the", " ", "render", "ed", " ", "software", " ", "definit", "ion", " ", "from", " ", "a", " ", "specific", " ", "sl", "s", " ", "file", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "local", " ", "winr", "epo", " ", "cache", ".", " ", "Thi", "s", " ", "will", " ", "parse", " ", "all", " ", "Jin", "ja", ".", " ", "Run", " ", "pkg", ".", "refre", "sh", "\\u", "db", " ", "to", " ", "pull", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "late", "st", " ", "software", " ", "definit", "ion", "s", " ", "from", " ", "the", " ", "master", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "str", " ", "name", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "name", " ", "of", " ", "the", " ", "package", " ", "you", " ", "want", " ", "to", " ", "view", ".", " ", "Start", " ", "from", " ", "the", " ", "local", " ", "winr", "epo", "\\", "10", ";", " ", " ", " ", " ", "root", ".", " ", "If", " ", "you", " ", "have", " ", "``.", "sl", "s", "``", " ", "files", " ", "organize", "d", " ", "in", " ", "subdir", "ector", "ies", " ", "you", "'", "ll", " ", "have", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "denote", " ", "them", " ", "with", " ", "``.", "``.", " ", "For", " ", "example", ",", " ", "if", " ", "I", " ", "have", " ", "a", " ", "``", "test", "``", " ", "director", "y", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "winr", "epo", " ", "root", " ", "with", " ", "a", " ", "``", "gv", "im", ".", "sl", "s", "``", " ", "file", " ", "insi", "de", ",", " ", "I", " ", "wou", "ld", " ", "target", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "file", " ", "like", " ", "so", ":", " ", "``", "test", ".", "gv", "im", "``.", " ", "Director", "ies", " ", "can", " ", "be", " ", "targeted", " ", "as", " ", "well", " ", "as", " ", "long", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "the", "y", " ", "contain", " ", "an", " ", "``", "init", ".", "sl", "s", "``", " ", "insi", "de", ".", " ", "For", " ", "example", ",", " ", "if", " ", "I", " ", "have", " ", "a", " ", "``", "node", "``", "\\", "10", ";", " ", " ", " ", " ", "director", "y", " ", "with", " ", "an", " ", "``", "init", ".", "sl", "s", "``", " ", "insi", "de", ",", " ", "I", " ", "wou", "ld", " ", "target", " ", "tha", "t", " ", "like", " ", "so", ":", "\\", "10", ";", " ", " ", " ", " ", "``", "node", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "str", " ", "salt", "env", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "environ", "ment", " ", "is", " ", "``", "base", "``", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "dictionar", "y", " ", "contain", "ing", " ", "the", " ", "render", "ed", " ", "data", " ", "structure", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "dict", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'*", "'", " ", "winr", "epo", ".", "show", "\\u", "sl", "s", " ", "gv", "im", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'*", "'", " ", "winr", "epo", ".", "show", "\\u", "sl", "s", " ", "test", ".", "np", "p", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "location", " ", "of", " ", "the", " ", "local", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "repo_", "=_", "\\u", "get", "\\u", "local", "\\u", "repo", "\\u", "dir_", "(_", "salt", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "sl", "s", " ", "file", " ", "name", " ", "to", " ", "the", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "repo_", "=_", "repo_", "._", "split_", "(_", "'\\\\\\\\'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "definition_", "=_", "name_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo_", "._", "extend_", "(_", "definition_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "the", " ", "sl", "s", " ", "file", " ", "by", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "sl", "s", "\\u", "file_", "=_", "'{", "0", "}.", "sl", "s", "'_", "._", "format_", "(_", "os_", "._", "sep_", "._", "join_", "(_", "repo_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "sl", "s", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ma", "yb", "e", " ", "it", "'", "s", " ", "a", " ", "director", "y", " ", "with", " ", "an", " ", "init", ".", "sl", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sl", "s", "\\u", "file_", "=_", "'{", "0", "}\\\\", "\\\\", "init", ".", "sl", "s", "'_", "._", "format_", "(_", "os_", "._", "sep_", "._", "join_", "(_", "repo_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "sl", "s", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "nei", "ther", ",", " ", "return_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Sof", "twa", "re", " ", "definit", "ion", " ", "{", "0", "}", " ", "not", " ", "found", "'_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "the", " ", "renderer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "renderers_", "=_", "salt_", "._", "loader_", "._", "render_", "(_", "\\u\\u", "opts", "\\u\\u_", ",_", "\\u\\u", "salt\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", " ", "the", " ", "file", " ", "through", " ", "the", " ", "renderer_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "=_", "salt_", "._", "template_", "._", "compile", "\\u", "template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "sl", "s", "\\u", "file_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "renderers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "opts", "\\u\\u_", "[_", "'", "render", "er", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dump", " ", "return", " ", "the", " ", "error", " ", "if", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sal", "t", "Render", "Error_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "'", "Fail", "ed", " ", "to", " ", "compile", " ", "{", "0", "}.'_", "._", "format_", "(_", "sl", "s", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "'", "Error", ":", " ", "{", "0", "}.'_", "._", "format_", "(_", "exc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "[_", "'", "Messag", "e", "'_", "]_", "=_", "'", "Fail", "ed", " ", "to", " ", "compile", " ", "{", "0", "}'_", "._", "format_", "(_", "sl", "s", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "[_", "'", "Error", "'_", "]_", "=_", "'{", "0", "}'_", "._", "format_", "(_", "exc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "config_" ]
[ 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, 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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 ]
Except block handles 'BaseException'
zunzun/pyeq2/Models_2D/LegendrePolynomial.py
[ { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n LegendreX_2 = inDataCacheDictionary['LegendreX_2'] # only need to perform this dictionary look-up once\n LegendreX_3 = inDataCacheDictionary['LegendreX_3'] # only need to perform this dictionary look-up once\n LegendreX_4 = inDataCacheDictionary['LegendreX_4'] # only need to perform this dictionary look-up once\n LegendreX_5 = inDataCacheDictionary['LegendreX_5'] # only need to perform this dictionary look-up once\n LegendreX_6 = inDataCacheDictionary['LegendreX_6'] # only need to perform this dictionary look-up once\n LegendreX_7 = inDataCacheDictionary['LegendreX_7'] # only need to perform this dictionary look-up once\n LegendreX_8 = inDataCacheDictionary['LegendreX_8'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n d = inCoeffs[3]\n f = inCoeffs[4]\n g = inCoeffs[5]\n h = inCoeffs[6]\n i = inCoeffs[7]\n j = inCoeffs[8]\n\n try:\n temp = a + b * x_in\n temp += c * LegendreX_2\n temp += d * LegendreX_3\n temp += f * LegendreX_4\n temp += g * LegendreX_5\n temp += h * LegendreX_6\n temp += i * LegendreX_7\n temp += j * LegendreX_8\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.EighthDegreeLegendrePolynomial.CalculateModelPredictions", "header": "['class', 'EighthDegreeLegendrePolynomial', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 98 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n LegendreX_2 = inDataCacheDictionary['LegendreX_2'] # only need to perform this dictionary look-up once\n LegendreX_3 = inDataCacheDictionary['LegendreX_3'] # only need to perform this dictionary look-up once\n LegendreX_4 = inDataCacheDictionary['LegendreX_4'] # only need to perform this dictionary look-up once\n LegendreX_5 = inDataCacheDictionary['LegendreX_5'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n d = inCoeffs[3]\n f = inCoeffs[4]\n g = inCoeffs[5]\n\n try:\n temp = a + b * x_in\n temp += c * LegendreX_2\n temp += d * LegendreX_3\n temp += f * LegendreX_4\n temp += g * LegendreX_5\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.FifthDegreeLegendrePolynomial.CalculateModelPredictions", "header": "['class', 'FifthDegreeLegendrePolynomial', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 181 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n LegendreX_2 = inDataCacheDictionary['LegendreX_2'] # only need to perform this dictionary look-up once\n LegendreX_3 = inDataCacheDictionary['LegendreX_3'] # only need to perform this dictionary look-up once\n LegendreX_4 = inDataCacheDictionary['LegendreX_4'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n d = inCoeffs[3]\n f = inCoeffs[4]\n\n try:\n temp = a + b * x_in\n temp += c * LegendreX_2\n temp += d * LegendreX_3\n temp += f * LegendreX_4\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.FourthDegreeLegendrePolynomial.CalculateModelPredictions", "header": "['class', 'FourthDegreeLegendrePolynomial', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 251 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n LegendreCosineDegreesX_2 = inDataCacheDictionary['LegendreCosineDegreesX_2'] # only need to perform this dictionary look-up once\n \n A0 = inCoeffs[0]\n A2 = inCoeffs[1]\n\n try:\n temp = A0 + A2 * LegendreCosineDegreesX_2\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.GammaRayAngularDistributionDegreesA.CalculateModelPredictions", "header": "['class', 'GammaRayAngularDistributionDegreesA', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 314 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n LegendreCosineDegreesX_2 = inDataCacheDictionary['LegendreCosineDegreesX_2'] # only need to perform this dictionary look-up once\n LegendreCosineDegreesX_4 = inDataCacheDictionary['LegendreCosineDegreesX_4'] # only need to perform this dictionary look-up once\n \n A0 = inCoeffs[0]\n A2 = inCoeffs[1]\n A4 = inCoeffs[2]\n\n try:\n temp = A0 + A2 * LegendreCosineDegreesX_2 + A4 * LegendreCosineDegreesX_4\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.GammaRayAngularDistributionDegreesB.CalculateModelPredictions", "header": "['class', 'GammaRayAngularDistributionDegreesB', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 366 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n LegendreCosineRadiansX_2 = inDataCacheDictionary['LegendreCosineRadiansX_2'] # only need to perform this dictionary look-up once\n \n A0 = inCoeffs[0]\n A2 = inCoeffs[1]\n\n try:\n temp = A0 + A2 * LegendreCosineRadiansX_2\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.GammaRayAngularDistributionRadiansA.CalculateModelPredictions", "header": "['class', 'GammaRayAngularDistributionRadiansA', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 419 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n LegendreCosineRadiansX_2 = inDataCacheDictionary['LegendreCosineRadiansX_2'] # only need to perform this dictionary look-up once\n LegendreCosineRadiansX_4 = inDataCacheDictionary['LegendreCosineRadiansX_4'] # only need to perform this dictionary look-up once\n \n A0 = inCoeffs[0]\n A2 = inCoeffs[1]\n A4 = inCoeffs[2]\n\n try:\n temp = A0 + A2 * LegendreCosineRadiansX_2 + A4 * LegendreCosineRadiansX_4\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.GammaRayAngularDistributionRadiansB.CalculateModelPredictions", "header": "['class', 'GammaRayAngularDistributionRadiansB', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 471 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n LegendreX_2 = inDataCacheDictionary['LegendreX_2'] # only need to perform this dictionary look-up once\n LegendreX_3 = inDataCacheDictionary['LegendreX_3'] # only need to perform this dictionary look-up once\n LegendreX_4 = inDataCacheDictionary['LegendreX_4'] # only need to perform this dictionary look-up once\n LegendreX_5 = inDataCacheDictionary['LegendreX_5'] # only need to perform this dictionary look-up once\n LegendreX_6 = inDataCacheDictionary['LegendreX_6'] # only need to perform this dictionary look-up once\n LegendreX_7 = inDataCacheDictionary['LegendreX_7'] # only need to perform this dictionary look-up once\n LegendreX_8 = inDataCacheDictionary['LegendreX_8'] # only need to perform this dictionary look-up once\n LegendreX_9 = inDataCacheDictionary['LegendreX_9'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n d = inCoeffs[3]\n f = inCoeffs[4]\n g = inCoeffs[5]\n h = inCoeffs[6]\n i = inCoeffs[7]\n j = inCoeffs[8]\n k = inCoeffs[9]\n\n try:\n temp = a + b * x_in\n temp += c * LegendreX_2\n temp += d * LegendreX_3\n temp += f * LegendreX_4\n temp += g * LegendreX_5\n temp += h * LegendreX_6\n temp += i * LegendreX_7\n temp += j * LegendreX_8\n temp += k * LegendreX_9\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.NinthDegreeLegendrePolynomial.CalculateModelPredictions", "header": "['class', 'NinthDegreeLegendrePolynomial', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 532 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n LegendreX_2 = inDataCacheDictionary['LegendreX_2'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = a + b * x_in\n temp += c * LegendreX_2\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.SecondDegreeLegendrePolynomial.CalculateModelPredictions", "header": "['class', 'SecondDegreeLegendrePolynomial', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 616 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n LegendreX_2 = inDataCacheDictionary['LegendreX_2'] # only need to perform this dictionary look-up once\n LegendreX_3 = inDataCacheDictionary['LegendreX_3'] # only need to perform this dictionary look-up once\n LegendreX_4 = inDataCacheDictionary['LegendreX_4'] # only need to perform this dictionary look-up once\n LegendreX_5 = inDataCacheDictionary['LegendreX_5'] # only need to perform this dictionary look-up once\n LegendreX_6 = inDataCacheDictionary['LegendreX_6'] # only need to perform this dictionary look-up once\n LegendreX_7 = inDataCacheDictionary['LegendreX_7'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n d = inCoeffs[3]\n f = inCoeffs[4]\n g = inCoeffs[5]\n h = inCoeffs[6]\n i = inCoeffs[7]\n\n try:\n temp = a + b * x_in\n temp += c * LegendreX_2\n temp += d * LegendreX_3\n temp += f * LegendreX_4\n temp += g * LegendreX_5\n temp += h * LegendreX_6\n temp += i * LegendreX_7\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.SeventhDegreeLegendrePolynomial.CalculateModelPredictions", "header": "['class', 'SeventhDegreeLegendrePolynomial', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 677 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n LegendreX_2 = inDataCacheDictionary['LegendreX_2'] # only need to perform this dictionary look-up once\n LegendreX_3 = inDataCacheDictionary['LegendreX_3'] # only need to perform this dictionary look-up once\n LegendreX_4 = inDataCacheDictionary['LegendreX_4'] # only need to perform this dictionary look-up once\n LegendreX_5 = inDataCacheDictionary['LegendreX_5'] # only need to perform this dictionary look-up once\n LegendreX_6 = inDataCacheDictionary['LegendreX_6'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n d = inCoeffs[3]\n f = inCoeffs[4]\n g = inCoeffs[5]\n h = inCoeffs[6]\n\n try:\n temp = a + b * x_in\n temp += c * LegendreX_2\n temp += d * LegendreX_3\n temp += f * LegendreX_4\n temp += g * LegendreX_5\n temp += h * LegendreX_6\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.SixthDegreeLegendrePolynomial.CalculateModelPredictions", "header": "['class', 'SixthDegreeLegendrePolynomial', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 757 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n LegendreX_2 = inDataCacheDictionary['LegendreX_2'] # only need to perform this dictionary look-up once\n LegendreX_3 = inDataCacheDictionary['LegendreX_3'] # only need to perform this dictionary look-up once\n LegendreX_4 = inDataCacheDictionary['LegendreX_4'] # only need to perform this dictionary look-up once\n LegendreX_5 = inDataCacheDictionary['LegendreX_5'] # only need to perform this dictionary look-up once\n LegendreX_6 = inDataCacheDictionary['LegendreX_6'] # only need to perform this dictionary look-up once\n LegendreX_7 = inDataCacheDictionary['LegendreX_7'] # only need to perform this dictionary look-up once\n LegendreX_8 = inDataCacheDictionary['LegendreX_8'] # only need to perform this dictionary look-up once\n LegendreX_9 = inDataCacheDictionary['LegendreX_9'] # only need to perform this dictionary look-up once\n LegendreX_10 = inDataCacheDictionary['LegendreX_10'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n d = inCoeffs[3]\n f = inCoeffs[4]\n g = inCoeffs[5]\n h = inCoeffs[6]\n i = inCoeffs[7]\n j = inCoeffs[8]\n k = inCoeffs[9]\n m = inCoeffs[10]\n\n try:\n temp = a + b * x_in\n temp += c * LegendreX_2\n temp += d * LegendreX_3\n temp += f * LegendreX_4\n temp += g * LegendreX_5\n temp += h * LegendreX_6\n temp += i * LegendreX_7\n temp += j * LegendreX_8\n temp += k * LegendreX_9\n temp += m * LegendreX_10\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.TenthDegreeLegendrePolynomial.CalculateModelPredictions", "header": "['class', 'TenthDegreeLegendrePolynomial', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 837 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n LegendreX_2 = inDataCacheDictionary['LegendreX_2'] # only need to perform this dictionary look-up once\n LegendreX_3 = inDataCacheDictionary['LegendreX_3'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n d = inCoeffs[3]\n\n try:\n temp = a + b * x_in\n temp += c * LegendreX_2\n temp += d * LegendreX_3\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.ThirdDegreeLegendrePolynomial.CalculateModelPredictions", "header": "['class', 'ThirdDegreeLegendrePolynomial', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 926 } ]
[ { "span": "except:", "start_line": 128, "start_column": 8, "end_line": 128, "end_column": 15 }, { "span": "except:", "start_line": 202, "start_column": 8, "end_line": 202, "end_column": 15 }, { "span": "except:", "start_line": 269, "start_column": 8, "end_line": 269, "end_column": 15 }, { "span": "except:", "start_line": 323, "start_column": 8, "end_line": 323, "end_column": 15 }, { "span": "except:", "start_line": 377, "start_column": 8, "end_line": 377, "end_column": 15 }, { "span": "except:", "start_line": 428, "start_column": 8, "end_line": 428, "end_column": 15 }, { "span": "except:", "start_line": 482, "start_column": 8, "end_line": 482, "end_column": 15 }, { "span": "except:", "start_line": 565, "start_column": 8, "end_line": 565, "end_column": 15 }, { "span": "except:", "start_line": 628, "start_column": 8, "end_line": 628, "end_column": 15 }, { "span": "except:", "start_line": 704, "start_column": 8, "end_line": 704, "end_column": 15 }, { "span": "except:", "start_line": 781, "start_column": 8, "end_line": 781, "end_column": 15 }, { "span": "except:", "start_line": 873, "start_column": 8, "end_line": 873, "end_column": 15 }, { "span": "except:", "start_line": 941, "start_column": 8, "end_line": 941, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Eig", "ht", "h", "Deg", "ree", "Legend", "re", "Polynomial", "_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "2_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "2", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "3_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "3", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "4_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "4", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "5_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "5", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "6_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "6", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "7_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "7", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "8_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "8", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "in", "Coeff", "s_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "in", "Coeff", "s_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "in", "Coeff", "s_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "in", "Coeff", "s_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "in", "Coeff", "s_", "[_", "7_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "in", "Coeff", "s_", "[_", "8_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "a_", "+_", "b_", "*_", "x", "\\u", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "c_", "*_", "Legend", "re", "X", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "d_", "*_", "Legend", "re", "X", "\\u", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "f_", "*_", "Legend", "re", "X", "\\u", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "g_", "*_", "Legend", "re", "X", "\\u", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "h_", "*_", "Legend", "re", "X", "\\u", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "i_", "*_", "Legend", "re", "X", "\\u", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "j_", "*_", "Legend", "re", "X", "\\u", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fifth", "Deg", "ree", "Legend", "re", "Polynomial", "_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "2_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "2", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "3_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "3", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "4_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "4", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "5_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "5", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "in", "Coeff", "s_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "in", "Coeff", "s_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "in", "Coeff", "s_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "a_", "+_", "b_", "*_", "x", "\\u", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "c_", "*_", "Legend", "re", "X", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "d_", "*_", "Legend", "re", "X", "\\u", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "f_", "*_", "Legend", "re", "X", "\\u", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "g_", "*_", "Legend", "re", "X", "\\u", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Four", "th", "Deg", "ree", "Legend", "re", "Polynomial", "_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "2_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "2", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "3_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "3", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "4_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "4", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "in", "Coeff", "s_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "in", "Coeff", "s_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "a_", "+_", "b_", "*_", "x", "\\u", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "c_", "*_", "Legend", "re", "X", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "d_", "*_", "Legend", "re", "X", "\\u", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "f_", "*_", "Legend", "re", "X", "\\u", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gamma", "Ray", "Angul", "ar", "Distribut", "ion", "Degrees", "A_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Legend", "re", "Cos", "ine", "Degrees", "X", "\\u", "2_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "Cos", "ine", "Degrees", "X", "\\u", "2", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "A0_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A2_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "A0_", "+_", "A2_", "*_", "Legend", "re", "Cos", "ine", "Degrees", "X", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gamma", "Ray", "Angul", "ar", "Distribut", "ion", "Degrees", "B_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Legend", "re", "Cos", "ine", "Degrees", "X", "\\u", "2_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "Cos", "ine", "Degrees", "X", "\\u", "2", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "Cos", "ine", "Degrees", "X", "\\u", "4_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "Cos", "ine", "Degrees", "X", "\\u", "4", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "A0_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A2_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A4", "_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "A0_", "+_", "A2_", "*_", "Legend", "re", "Cos", "ine", "Degrees", "X", "\\u", "2_", "+_", "A4", "_", "*_", "Legend", "re", "Cos", "ine", "Degrees", "X", "\\u", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gamma", "Ray", "Angul", "ar", "Distribut", "ion", "Radia", "ns", "A_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Legend", "re", "Cos", "ine", "Radia", "ns", "X", "\\u", "2_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "Cos", "ine", "Radia", "ns", "X", "\\u", "2", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "A0_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A2_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "A0_", "+_", "A2_", "*_", "Legend", "re", "Cos", "ine", "Radia", "ns", "X", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gamma", "Ray", "Angul", "ar", "Distribut", "ion", "Radia", "ns", "B_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Legend", "re", "Cos", "ine", "Radia", "ns", "X", "\\u", "2_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "Cos", "ine", "Radia", "ns", "X", "\\u", "2", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "Cos", "ine", "Radia", "ns", "X", "\\u", "4_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "Cos", "ine", "Radia", "ns", "X", "\\u", "4", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "A0_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A2_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A4", "_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "A0_", "+_", "A2_", "*_", "Legend", "re", "Cos", "ine", "Radia", "ns", "X", "\\u", "2_", "+_", "A4", "_", "*_", "Legend", "re", "Cos", "ine", "Radia", "ns", "X", "\\u", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Nin", "th", "Deg", "ree", "Legend", "re", "Polynomial", "_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "2_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "2", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "3_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "3", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "4_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "4", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "5_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "5", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "6_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "6", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "7_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "7", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "8_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "8", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "9_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "9", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "in", "Coeff", "s_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "in", "Coeff", "s_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "in", "Coeff", "s_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "in", "Coeff", "s_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "in", "Coeff", "s_", "[_", "7_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "in", "Coeff", "s_", "[_", "8_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "in", "Coeff", "s_", "[_", "9_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "a_", "+_", "b_", "*_", "x", "\\u", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "c_", "*_", "Legend", "re", "X", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "d_", "*_", "Legend", "re", "X", "\\u", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "f_", "*_", "Legend", "re", "X", "\\u", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "g_", "*_", "Legend", "re", "X", "\\u", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "h_", "*_", "Legend", "re", "X", "\\u", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "i_", "*_", "Legend", "re", "X", "\\u", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "j_", "*_", "Legend", "re", "X", "\\u", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "k_", "*_", "Legend", "re", "X", "\\u", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Second", "Deg", "ree", "Legend", "re", "Polynomial", "_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "2_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "2", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "a_", "+_", "b_", "*_", "x", "\\u", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "c_", "*_", "Legend", "re", "X", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Seve", "nth", "Deg", "ree", "Legend", "re", "Polynomial", "_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "2_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "2", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "3_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "3", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "4_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "4", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "5_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "5", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "6_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "6", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "7_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "7", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "in", "Coeff", "s_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "in", "Coeff", "s_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "in", "Coeff", "s_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "in", "Coeff", "s_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "in", "Coeff", "s_", "[_", "7_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "a_", "+_", "b_", "*_", "x", "\\u", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "c_", "*_", "Legend", "re", "X", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "d_", "*_", "Legend", "re", "X", "\\u", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "f_", "*_", "Legend", "re", "X", "\\u", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "g_", "*_", "Legend", "re", "X", "\\u", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "h_", "*_", "Legend", "re", "X", "\\u", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "i_", "*_", "Legend", "re", "X", "\\u", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Six", "th", "Deg", "ree", "Legend", "re", "Polynomial", "_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "2_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "2", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "3_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "3", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "4_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "4", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "5_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "5", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "6_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "6", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "in", "Coeff", "s_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "in", "Coeff", "s_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "in", "Coeff", "s_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "in", "Coeff", "s_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "a_", "+_", "b_", "*_", "x", "\\u", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "c_", "*_", "Legend", "re", "X", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "d_", "*_", "Legend", "re", "X", "\\u", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "f_", "*_", "Legend", "re", "X", "\\u", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "g_", "*_", "Legend", "re", "X", "\\u", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "h_", "*_", "Legend", "re", "X", "\\u", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ten", "th", "Deg", "ree", "Legend", "re", "Polynomial", "_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "2_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "2", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "3_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "3", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "4_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "4", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "5_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "5", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "6_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "6", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "7_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "7", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "8_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "8", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "9_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "9", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "10_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "10", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "in", "Coeff", "s_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "in", "Coeff", "s_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "in", "Coeff", "s_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "in", "Coeff", "s_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "in", "Coeff", "s_", "[_", "7_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "in", "Coeff", "s_", "[_", "8_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "in", "Coeff", "s_", "[_", "9_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "in", "Coeff", "s_", "[_", "10_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "a_", "+_", "b_", "*_", "x", "\\u", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "c_", "*_", "Legend", "re", "X", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "d_", "*_", "Legend", "re", "X", "\\u", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "f_", "*_", "Legend", "re", "X", "\\u", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "g_", "*_", "Legend", "re", "X", "\\u", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "h_", "*_", "Legend", "re", "X", "\\u", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "i_", "*_", "Legend", "re", "X", "\\u", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "j_", "*_", "Legend", "re", "X", "\\u", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "k_", "*_", "Legend", "re", "X", "\\u", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "m_", "*_", "Legend", "re", "X", "\\u", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Thi", "rd", "Deg", "ree", "Legend", "re", "Polynomial", "_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "2_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "2", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Legend", "re", "X", "\\u", "3_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Legend", "re", "X", "\\u", "3", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "in", "Coeff", "s_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "a_", "+_", "b_", "*_", "x", "\\u", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "c_", "*_", "Legend", "re", "X", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "+=_", "d_", "*_", "Legend", "re", "X", "\\u", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Unused import
sjuxax/raggregate/raggregate/models/sectionpicture.py
[ { "content": "from raggregate.models import *\n\nimport sqlalchemy\nfrom sqlalchemy import Column\nfrom sqlalchemy import Integer\nfrom sqlalchemy import Unicode\nfrom sqlalchemy import UnicodeText\nfrom sqlalchemy import DateTime\nfrom sqlalchemy import text\nfrom sqlalchemy import Boolean\nfrom sqlalchemy import ForeignKey\n\nfrom raggregate.guid_recipe import GUID\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SectionPicture(Base):\n __tablename__ = 'section_pictures'\n\n id = Column(GUID, primary_key=True)\n orig_filename = Column(UnicodeText)\n filename = Column(UnicodeText)\n file_hash = Column(UnicodeText)\n # 0 for section's computer\n # 1 for twitter\n # 2 for facebook\n source = Column(Integer, default=0)\n # @TODO: we should implement storage_schemes, etc., here.\n", "metadata": "root.SectionPicture", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def __init__(self, orig_filename, filename, file_hash, source):\n self.orig_filename = orig_filename\n self.filename = filename\n self.file_hash = file_hash\n self.source = source", "metadata": "root.SectionPicture.__init__", "header": "['class', 'SectionPicture', '(', 'Base', ')', ':', '___EOS___']", "index": 27 } ]
[ { "span": "import sqlalchemy", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 17 }, { "span": "from sqlalchemy import Unicode", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 30 }, { "span": "from sqlalchemy import DateTime", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 31 }, { "span": "from sqlalchemy import text", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 27 }, { "span": "from sqlalchemy import Boolean", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 30 }, { "span": "from sqlalchemy import ForeignKey", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "ragg", "rega", "te_", "._", "models_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sqlalchemy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "import_", "Column_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "import_", "Integer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "import_", "Unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "import_", "Unic", "ode", "Text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "import_", "Date", "Time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "import_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "import_", "Boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "import_", "Fore", "ign", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ragg", "rega", "te_", "._", "guid", "\\u", "recipe_", "import_", "GUID", "_", "\\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_", "Sect", "ion", "Picture", "_", "(_", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "section", "\\u", "pictures", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "Column_", "(_", "GUID", "_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "\\u", "filename_", "=_", "Column_", "(_", "Unic", "ode", "Text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "Column_", "(_", "Unic", "ode", "Text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "hash_", "=_", "Column_", "(_", "Unic", "ode", "Text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "0", " ", "for", " ", "section", "'", "s", " ", "computer_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", " ", "for", " ", "twitter_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", " ", "for", " ", "facebook", "_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "Column_", "(_", "Integer_", ",_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "@", "TOD", "O", ":", " ", "we", " ", "shou", "ld", " ", "implement", " ", "storage", "\\u", "schemes", ",", " ", "etc", ".,", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sect", "ion", "Picture", "_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "orig", "\\u", "filename_", ",_", "filename_", ",_", "file", "\\u", "hash_", ",_", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "orig", "\\u", "filename_", "=_", "orig", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filename_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file", "\\u", "hash_", "=_", "file", "\\u", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "source_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
neurodata/ndstore/ingest/forrest/collman14EM.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 cStringIO\nimport zlib\n\nsys.path += [os.path.abspath('../../django')]\nimport OCP.settings\nos.environ['DJANGO_SETTINGS_MODULE'] = 'OCP.settings'\nfrom django.conf import settings\n\nimport OCP.ocppaths\nimport ocpcarest\n\nimport zindex\n\nimport gc\n\n#\n# ingest the PNG files into the database\n#\n\n\"\"\"This file is super-customized for Bobby's meso-scale s1 data\"\"\"\n\n# Stuff we make take from a config or the command line in the future\n#ximagesz = 12000\n#yimagesz = 12000\n\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='Ingest the FlyEM image data.')\n parser.add_argument('token', action=\"store\", help='Token for the annotation project.')\n parser.add_argument('path', action=\"store\", help='Directory with annotation PNG files.')\n\n result = parser.parse_args()\n\n # convert to an argument\n resolution = 0\n\n # load a database\n [ db, proj, projdb ] = ocpcarest.loadDBProj ( result.token )\n\n # get the dataset configuration\n (xcubedim,ycubedim,zcubedim)=proj.datasetcfg.cubedim[resolution]\n (startslice,endslice)=proj.datasetcfg.slicerange\n batchsz=zcubedim\n\n # This doesn't work because the image size does not match exactly the cube size\n #(ximagesz,yimagesz)=proj.datasetcfg.imagesz[resolution]\n ximagesz = 9888\n yimagesz = 7936\n\n # Get a list of the files in the directories\n for sl in range (startslice,endslice+1,batchsz):\n\n slab = np.zeros ( [ batchsz, yimagesz, ximagesz ], dtype=np.uint8 )\n \n for b in range ( batchsz ):\n\n if ( sl + b <= endslice ):\n\n # raw data\n filenm = '{}EM10K-{:0>2}.tif'.format(result.path,sl+b)\n print \"Opening filenm \" + filenm\n \n img = Image.open ( filenm, 'r' )\n imgdata = np.asarray ( img )\n slab[b,:,:] = imgdata\n\n # the last z offset that we ingest, if the batch ends before batchsz\n endz = b\n \n\n # Now we have a 1024x1024x16 z-aligned cube. \n # Send it to the database.\n for y in range ( 0, yimagesz, ycubedim ):\n for x in range ( 0, ximagesz, xcubedim ):\n\n mortonidx = zindex.XYZMorton ( [ x/xcubedim, y/ycubedim, (sl-startslice)/zcubedim] )\n cubedata = np.zeros ( [zcubedim, ycubedim, xcubedim], dtype=np.uint8 )\n\n xmin = x\n ymin = y\n xmax = min ( ximagesz, x+xcubedim )\n ymax = min ( yimagesz, y+ycubedim )\n zmin = 0\n zmax = min(sl+zcubedim,endslice+1)\n\n cubedata[0:zmax-zmin,0:ymax-ymin,0:xmax-xmin] = slab[zmin:zmax,ymin:ymax,xmin:xmax]\n\n # Dont' ingest empty cubes\n if len(np.unique(cubedata)) == 1:\n continue\n\n # create the DB BLOB\n fileobj = cStringIO.StringIO ()\n np.save ( fileobj, cubedata )\n cdz = zlib.compress (fileobj.getvalue())\n\n # insert the blob into the database\n cursor = db.conn.cursor()\n sql = \"INSERT INTO res{} (zindex, cube) VALUES (%s, %s)\".format(int(resolution))\n cursor.execute(sql, (mortonidx, cdz))\n cursor.close()\n\n print \"Commiting at x=%s, y=%s, z=%s\" % (x,y,sl)\n db.conn.commit()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 47 } ]
[ { "span": "import OCP.settings", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 19 }, { "span": "from django.conf import settings", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 32 }, { "span": "import OCP.ocppaths", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 19 }, { "span": "import gc", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 9 } ]
[]
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_", "c", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "+=_", "[_", "os_", "._", "path_", "._", "abspath_", "(_", "'../../", "django", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "OC", "P_", "._", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "DJANGO", "\\u", "SETTING", "S", "\\u", "MODUL", "E", "'_", "]_", "=_", "'", "OC", "P", ".", "settings", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "OC", "P_", "._", "oc", "ppa", "ths_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "oc", "pca", "rest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "zin", "dex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "gc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "ingest", " ", "the", " ", "PNG", " ", "files", " ", "int", "o", " ", "the", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Thi", "s", " ", "file", " ", "is", " ", "super", "-", "customize", "d", " ", "for", " ", "Bob", "by", "'", "s", " ", "mes", "o", "-", "scale", " ", "s1", " ", "data", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Stuff", " ", "we", " ", "make", " ", "take", " ", "from", " ", "a", " ", "config", " ", "or", " ", "the", " ", "command", " ", "line", " ", "in", " ", "the", " ", "future_", "\\u\\u\\uNL\\u\\u\\u_", "#", "xim", "age", "sz", " ", "=", " ", "1200", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "yi", "mage", "sz", " ", "=", " ", "1200", "0_", "\\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\\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_", "=_", "'", "Ing", "est", " ", "the", " ", "Fly", "EM", " ", "image", " ", "data", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "token", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "help_", "=_", "'", "Token", " ", "for", " ", "the", " ", "annot", "ation", " ", "project", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "path", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "help_", "=_", "'", "Director", "y", " ", "with", " ", "annot", "ation", " ", "PNG", " ", "files", ".'_", ")_", "\\u\\u\\uNEWLINE\\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_", "#", " ", "convert", " ", "to", " ", "an", " ", "argument_", "\\u\\u\\uNL\\u\\u\\u_", "resolution_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "load", " ", "a", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "db_", ",_", "proj_", ",_", "proj", "db_", "]_", "=_", "oc", "pca", "rest_", "._", "load", "DB", "Proj", "_", "(_", "result_", "._", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "dataset", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "xc", "ube", "dim_", ",_", "yc", "ube", "dim_", ",_", "zc", "ube", "dim_", ")_", "=_", "proj_", "._", "dataset", "cfg_", "._", "cube", "dim_", "[_", "resolution_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "starts", "lice", "_", ",_", "ends", "lice", "_", ")_", "=_", "proj_", "._", "dataset", "cfg_", "._", "slicer", "ange_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch", "sz_", "=_", "zc", "ube", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "doe", "sn", "'", "t", " ", "work", " ", "bec", "aus", "e", " ", "the", " ", "image", " ", "size", " ", "doe", "s", " ", "not", " ", "match", " ", "exact", "ly", " ", "the", " ", "cube", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "#(", "xim", "age", "sz", ",", "yi", "mage", "sz", ")=", "proj", ".", "dataset", "cfg", ".", "images", "z", "[", "resolu", "tion", "]_", "\\u\\u\\uNL\\u\\u\\u_", "xim", "age", "sz_", "=_", "988", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yi", "mage", "sz_", "=_", "793", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "a", " ", "list", " ", "of", " ", "the", " ", "files", " ", "in", " ", "the", " ", "directories_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "sl_", "in_", "range_", "(_", "starts", "lice", "_", ",_", "ends", "lice", "_", "+_", "1_", ",_", "batch", "sz_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slab", "_", "=_", "np_", "._", "zeros_", "(_", "[_", "batch", "sz_", ",_", "yi", "mage", "sz_", ",_", "xim", "age", "sz_", "]_", ",_", "dtype_", "=_", "np_", "._", "uint8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "b_", "in_", "range_", "(_", "batch", "sz_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "sl_", "+_", "b_", "<=_", "ends", "lice", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "raw", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filen", "m_", "=_", "'{}", "EM", "10", "K", "-", "{:", "0", ">", "2", "}.", "tif", "'_", "._", "format_", "(_", "result_", "._", "path_", ",_", "sl_", "+_", "b_", ")_", "\\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_", "img_", "=_", "Image_", "._", "open_", "(_", "filen", "m_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "data_", "=_", "np_", "._", "asarray_", "(_", "img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slab", "_", "[_", "b_", ",_", ":_", ",_", ":_", "]_", "=_", "img", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "last", " ", "z", " ", "offset", " ", "tha", "t", " ", "we", " ", "ingest", ",", " ", "if", " ", "the", " ", "batch", " ", "ends", " ", "bef", "ore", " ", "batch", "sz_", "\\u\\u\\uNL\\u\\u\\u_", "end", "z_", "=_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "we", " ", "have", " ", "a", " ", "1024", "x1", "024", "x1", "6", " ", "z", "-", "aligned", " ", "cube", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sen", "d", " ", "it", " ", "to", " ", "the", " ", "databa", "se", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "y_", "in_", "range_", "(_", "0_", ",_", "yi", "mage", "sz_", ",_", "yc", "ube", "dim_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "xim", "age", "sz_", ",_", "xc", "ube", "dim_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mort", "oni", "dx_", "=_", "zin", "dex_", "._", "XY", "ZM", "ort", "on_", "(_", "[_", "x_", "/_", "xc", "ube", "dim_", ",_", "y_", "/_", "yc", "ube", "dim_", ",_", "(_", "sl_", "-_", "starts", "lice", "_", ")_", "/_", "zc", "ube", "dim_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube", "data_", "=_", "np_", "._", "zeros_", "(_", "[_", "zc", "ube", "dim_", ",_", "yc", "ube", "dim_", ",_", "xc", "ube", "dim_", "]_", ",_", "dtype_", "=_", "np_", "._", "uint8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xmin_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymin_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xmax_", "=_", "min_", "(_", "xim", "age", "sz_", ",_", "x_", "+_", "xc", "ube", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymax_", "=_", "min_", "(_", "yi", "mage", "sz_", ",_", "y_", "+_", "yc", "ube", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zmin", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zmax", "_", "=_", "min_", "(_", "sl_", "+_", "zc", "ube", "dim_", ",_", "ends", "lice", "_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cube", "data_", "[_", "0_", ":_", "zmax", "_", "-_", "zmin", "_", ",_", "0_", ":_", "ymax_", "-_", "ymin_", ",_", "0_", ":_", "xmax_", "-_", "xmin_", "]_", "=_", "slab", "_", "[_", "zmin", "_", ":_", "zmax", "_", ",_", "ymin_", ":_", "ymax_", ",_", "xmin_", ":_", "xmax_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Don", "t", "'", " ", "ingest", " ", "empty", " ", "cubes", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "np_", "._", "unique_", "(_", "cube", "data_", ")_", ")_", "==_", "1_", ":_", "\\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_", "#", " ", "create", " ", "the", " ", "DB", " ", "BLOB", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fileobj_", "=_", "c", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "save_", "(_", "fileobj_", ",_", "cube", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cd", "z_", "=_", "zlib_", "._", "compress_", "(_", "fileobj_", "._", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "insert", " ", "the", " ", "blob", " ", "int", "o", " ", "the", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "=_", "db_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "\"", "INSERT", " ", "INT", "O", " ", "res", "{}", " ", "(", "zin", "dex", ",", " ", "cube", ")", " ", "VALU", "ES", " ", "(%", "s", ",", " ", "%", "s", ")\"_", "._", "format_", "(_", "int_", "(_", "resolution_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "sql_", ",_", "(_", "mort", "oni", "dx_", ",_", "cd", "z_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Commi", "ting", " ", "at", " ", "x", "=", "%", "s", ",", " ", "y", "=", "%", "s", ",", " ", "z", "=", "%", "s", "\"_", "%_", "(_", "x_", ",_", "y_", ",_", "sl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "conn_", "._", "commit_", "(_", ")_", "\\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,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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 ]
Unused local variable
ardekantur/pyglet/tools/epydoc/epydoc/apidoc.py
[ { "content": " def merge_and_overwrite(self, other, ignore_hash_conflict=False):\n \"\"\"\n Combine C{self} and C{other} into a X{merged object}, such\n that any changes made to one will affect the other. Any\n attributes that C{other} had before merging will be discarded.\n This is accomplished by copying C{self.__dict__} over\n C{other.__dict__} and C{self.__class__} over C{other.__class__}.\n\n Care must be taken with this method, since it modifies the\n hash value of C{other}. To help avoid the problems that this\n can cause, C{merge_and_overwrite} will raise an exception if\n C{other} has ever been hashed, unless C{ignore_hash_conflict}\n is True. Note that adding C{other} to a dictionary, set, or\n similar data structure will implicitly cause it to be hashed.\n If you do set C{ignore_hash_conflict} to True, then any\n existing data structures that rely on C{other}'s hash staying\n constant may become corrupted.\n\n @return: C{self}\n @raise ValueError: If C{other} has ever been hashed.\n \"\"\"\n # If we're already merged, then there's nothing to do.\n if (self.__dict__ is other.__dict__ and\n self.__class__ is other.__class__): return self\n \n if other.__has_been_hashed and not ignore_hash_conflict:\n raise ValueError(\"%r has already been hashed! Merging it \"\n \"would cause its has value to change.\" % other)\n\n # If other was itself already merged with anything,\n # then we need to merge those too.\n a,b = (self.__mergeset, other.__mergeset)\n mergeset = (self.__mergeset or [self]) + (other.__mergeset or [other])\n other.__dict__.clear()\n for apidoc in mergeset:\n #if apidoc is self: pass\n apidoc.__class__ = self.__class__\n apidoc.__dict__ = self.__dict__\n self.__mergeset = mergeset\n # Sanity chacks.\n assert self in mergeset and other in mergeset\n for apidoc in mergeset:\n assert apidoc.__dict__ is self.__dict__\n # Return self.\n return self", "metadata": "root.APIDoc.merge_and_overwrite", "header": "['class', 'APIDoc', '(', 'object', ')', ':', '___EOS___']", "index": 475 } ]
[ { "span": "a,", "start_line": 506, "start_column": 8, "end_line": 506, "end_column": 9 }, { "span": "b ", "start_line": 506, "start_column": 10, "end_line": 506, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "API", "Doc_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "merge", "\\u", "and", "\\u", "overwrite_", "(_", "self_", ",_", "other_", ",_", "ignore", "\\u", "hash", "\\u", "conflict_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Combine", " ", "C", "{", "self", "}", " ", "and", " ", "C", "{", "other", "}", " ", "int", "o", " ", "a", " ", "X", "{", "merge", "d", " ", "object", "},", " ", "suc", "h", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "any", " ", "change", "s", " ", "made", " ", "to", " ", "one", " ", "will", " ", "affect", " ", "the", " ", "other", ".", " ", " ", "Any", "\\", "10", ";", " ", " ", " ", " ", "attribute", "s", " ", "tha", "t", " ", "C", "{", "other", "}", " ", "had", " ", "bef", "ore", " ", "mer", "ging", " ", "will", " ", "be", " ", "discard", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "accom", "pli", "shed", " ", "by", " ", "copy", "ing", " ", "C", "{", "self", ".\\u", "\\u", "dict", "\\u\\u}", " ", "over", "\\", "10", ";", " ", " ", " ", " ", "C", "{", "other", ".\\u", "\\u", "dict", "\\u\\u}", " ", "and", " ", "C", "{", "self", ".\\u", "\\u", "class", "\\u\\u}", " ", "over", " ", "C", "{", "other", ".\\u", "\\u", "class", "\\u\\u}", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Care", " ", "must", " ", "be", " ", "take", "n", " ", "with", " ", "this", " ", "method", ",", " ", "sinc", "e", " ", "it", " ", "modifi", "es", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "hash", " ", "value", " ", "of", " ", "C", "{", "other", "}.", " ", " ", "To", " ", "help", " ", "avoid", " ", "the", " ", "problem", "s", " ", "tha", "t", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "can", " ", "caus", "e", ",", " ", "C", "{", "merge", "\\u", "and", "\\u", "overwrit", "e", "}", " ", "will", " ", "raise", " ", "an", " ", "exception", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "C", "{", "other", "}", " ", "has", " ", "ever", " ", "bee", "n", " ", "hashed", ",", " ", "unl", "ess", " ", "C", "{", "ignore", "\\u", "hash", "\\u", "confl", "ict", "}", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "Tru", "e", ".", " ", " ", "Not", "e", " ", "tha", "t", " ", "addin", "g", " ", "C", "{", "other", "}", " ", "to", " ", "a", " ", "dictionar", "y", ",", " ", "set", ",", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "similar", " ", "data", " ", "structure", " ", "will", " ", "implicit", "ly", " ", "caus", "e", " ", "it", " ", "to", " ", "be", " ", "hashed", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "you", " ", "do", " ", "set", " ", "C", "{", "ignore", "\\u", "hash", "\\u", "confl", "ict", "}", " ", "to", " ", "Tru", "e", ",", " ", "then", " ", "any", "\\", "10", ";", " ", " ", " ", " ", "exist", "ing", " ", "data", " ", "structure", "s", " ", "tha", "t", " ", "rely", " ", "on", " ", "C", "{", "other", "}'", "s", " ", "hash", " ", "stay", "ing", "\\", "10", ";", " ", " ", " ", " ", "constant", " ", "may", " ", "bec", "ome", " ", "corrupted", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "C", "{", "self", "}", "\\", "10", ";", " ", " ", " ", " ", "@", "raise", " ", "Value", "Error", ":", " ", "If", " ", "C", "{", "other", "}", " ", "has", " ", "ever", " ", "bee", "n", " ", "hashed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", "'", "re", " ", "alr", "ead", "y", " ", "merge", "d", ",", " ", "then", " ", "there", "'", "s", " ", "not", "hing", " ", "to", " ", "do", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u\\u", "dict\\u\\u_", "is_", "other_", "._", "\\u\\u", "dict\\u\\u_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "is_", "other_", "._", "\\u\\u", "class\\u\\u_", ")_", ":_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "other_", "._", "\\u\\u", "has", "\\u", "bee", "n", "\\u", "hashed", "_", "and_", "not_", "ignore", "\\u", "hash", "\\u", "conflict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"%", "r", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "hashed", "!", " ", " ", "Mer", "ging", " ", "it", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "wou", "ld", " ", "caus", "e", " ", "its", " ", "has", " ", "value", " ", "to", " ", "change", ".\"_", "%_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "other", " ", "was", " ", "its", "elf", " ", "alr", "ead", "y", " ", "merge", "d", " ", "with", " ", "anyt", "hing", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "we", " ", "need", " ", "to", " ", "merge", " ", "tho", "se", " ", "too", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "a_", ",_", "b_", "=_", "(_", "self_", "._", "\\u\\u", "merges", "et_", ",_", "other_", "._", "\\u\\u", "merges", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merges", "et_", "=_", "(_", "self_", "._", "\\u\\u", "merges", "et_", "or_", "[_", "self_", "]_", ")_", "+_", "(_", "other_", "._", "\\u\\u", "merges", "et_", "or_", "[_", "other_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "._", "\\u\\u", "dict\\u\\u_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "apid", "oc_", "in_", "merges", "et_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "apid", "oc", " ", "is", " ", "self", ":", " ", "pass_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "apid", "oc_", "._", "\\u\\u", "class\\u\\u_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apid", "oc_", "._", "\\u\\u", "dict\\u\\u_", "=_", "self_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "merges", "et_", "=_", "merges", "et_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "cha", "cks", "._", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "in_", "merges", "et_", "and_", "other_", "in_", "merges", "et_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "apid", "oc_", "in_", "merges", "et_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "apid", "oc_", "._", "\\u\\u", "dict\\u\\u_", "is_", "self_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Return", " ", "self", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Variable defined multiple times
mertyildiran/Cerebrum/cerebrum/vision/developmentExamples/opencv-optical-flow.py
[ { "content": "# USAGE\n# python opencv-optical-flow.py\n# python opencv-optical-flow.py --video PATH/example_01.mp4\n\nimport numpy\nimport cv2\nimport argparse\nimport time\nimport random\nimport math\nimport imutils\nfrom collections import Counter\n\nTRACKER_POINTS = 500 # How many points will be used to track the optical flow\nCRAZY_LINE_DISTANCE = 50 # Distance value to detect crazy lines\nCRAZY_LINE_LIMIT = 100 * TRACKER_POINTS / 1000 # Amount of crazy lines are indication of different shots\nABSDIFF_ANGLE = 20 # To determine the inconsistency between tangent values in degrees\nLINE_THICKNESS = 3 # Lines thickness that we will use for mask delta\nCONTOUR_LIMIT = 10 # Contour limit for detecting ZOOM, ZOOM + PAN, ZOOM + TILT, ZOOM + ROLL (Not just PAN, TILT, ROLL)\nTARGET_HEIGHT = 360 # Number of horizontal lines for target video and processing. Like 720p, 360p etc.\nDELTA_LIMIT_DIVISOR = 3 # Divisor for detecting too much motion. Like: ( height * width / X )\n\n# Construct the argument parser and parse the arguments\nap = argparse.ArgumentParser()\nap.add_argument(\"-v\", \"--video\", help=\"path to the video file\")\nap.add_argument(\"-a\", \"--min-area\", type=int, default=500, help=\"minimum area size\")\nargs = vars(ap.parse_args())\n\nif args.get(\"video\", None) is None: # If the video argument is None, then we are reading from webcam\n\tcap = cv2.VideoCapture(0)\n\ttime.sleep(0.25)\nelse: # Otherwise, we are reading from a video file\n\tcap = cv2.VideoCapture(args[\"video\"])\n\n# Parameters for Lucas Kanade Optical Flow\nlk_params = dict( winSize = (15,15),\n\t\t\t\t maxLevel = 2,\n\t\t\t\t criteria = (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 0.03))\n\nwhile True: # On this level it gets only one frame\n\n\tcolor = numpy.random.randint(0,255,(TRACKER_POINTS,3)) # Create some random colors\n\n\tret, old_frame = cap.read() # Take first frame\n\told_frame = imutils.resize(old_frame, height=TARGET_HEIGHT) # Resize frame to 360p. Alternative resizing method:\n\told_gray = cv2.cvtColor(old_frame, cv2.COLOR_BGR2GRAY) # Convert previous frame to grayscale\n\n\theight, width = old_frame.shape[:2] # Get video height and width (size)\n\n\t# Create random points on frame\n\tp1 = numpy.random.randint(width, size=(TRACKER_POINTS, 1, 2))\n\tfor y in p1: # Get y values one by one\n\t\t if y[0][1] > height: # If there is a y value that greater than max height\n\t\t\t y[0][1] = numpy.random.random_integers(height) # Random again this time with max height value\n\tp1 = p1.astype(numpy.float32) # Change numpy array's data type to float32\n\n\tmask = numpy.zeros_like(old_frame) # Create a mask image for drawing purposes (original frame)\n\tmask_delta = numpy.zeros_like(old_frame) # Create a mask image for drawing purposes (delta frame)\n\tmask_white = numpy.ones_like(old_frame) # Create a white mask image for cloning original frame\n\twhite_color = numpy.array([255,255,255]) # Define color white\n\n\ttotal_crazy_lines = 0 # Crazy line counter\n\n\tmost_common_angle = None # Most common angle in general optical flow in shot\n\n\twhile True: # Loop over the frames of the video\n\n\t\tmask_biggest_contour = numpy.zeros_like(old_frame) # Create a mask image for drawing purposes (biggest contour frame)\n\n\t\tret,frame = cap.read() # Take a new frame\n\t\tframe = imutils.resize(frame, height=TARGET_HEIGHT) # Resize frame to 360p. Alternative resizing method:\n\t\tframe_gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) # Convert it to grayscale\n\n\t\tdelta_value = 0 # Delta Value for storing max continuous contour area for current frame\n\n\t\tp2, st, err = cv2.calcOpticalFlowPyrLK(old_gray, frame_gray, p1, None, **lk_params) # Calculate optical flow (Lucas Kanade Optical Flow function of OpenCV)\n\n\t\tif p2 is None: # If there are not any points that coming from Lucas Kanade Optical Flow function of OpenCV\n\t\t\tbreak # Break the loop to reconstruct the optical flow\n\n\t\t# Select good points\n\t\tgood_points2 = p2[st==1]\n\t\tgood_points1 = p1[st==1]\n\n\t\tangles_array = [] # Angle list of all newly created tiny lines\n\n\t\tfor i,(good_point2,good_point1) in enumerate(zip(good_points2,good_points1)): # Get point pairs one by one\n\n\t\t\t# Get coordinates of points\n\t\t\tx2,y2 = good_point2.ravel() # New point\n\t\t\tx1,y1 = good_point1.ravel() # Previous point\n\n\t\t\tdistance = math.hypot(x2 - x1, y2 - y1) # Length of the tiny line between these two points.\n\n\t\t\tif distance >= CRAZY_LINE_DISTANCE: # If the line is not that \"tiny\" it's CRAZY! xD\n\t\t\t\ttotal_crazy_lines += 1 # Then increase total crazy line counter's value\n\n\t\t\tangle = math.atan2(y2-y1, x2-x1) # Calculate tangent value of the line (returns Radian)\n\t\t\tangle = math.degrees(angle) # Radian to Degree\n\t\t\tangle = round(angle) # Round up the degree\n\t\t\tangles_array.append(angle) # Append the degree to Angle List\n\n\t\t\tif most_common_angle != None: # If there is a most common angle value\n\t\t\t\tif abs(most_common_angle - angle) > ABSDIFF_ANGLE: # If Absolute Difference between most common angle and the current line's angle greater than ABDSDIFF_ANGLE value, this line is inconsistent to current general optical flow\n\t\t\t\t\tcv2.line(mask_delta, (x2,y2),(x1,y1), white_color, LINE_THICKNESS) # Then draw a white line to mask_delta\n\n\t\t\tcv2.line(mask, (x2,y2),(x1,y1), color[i].tolist(), 1) # In every frame draw the colored lines to original frame for better understanding (optional)\n\n\t\tif angles_array: # If angles_array is not empty\n\t\t\tmost_common_angle = Counter(angles_array).most_common()[0][0] # Find most common angle value in Angle List\n\n\t\tmask_delta_gray = cv2.cvtColor(mask_delta, cv2.COLOR_BGR2GRAY) # Convert mask_delta to grayscale\n\t\tthresh = cv2.threshold(mask_delta_gray, 12, 255, cv2.THRESH_BINARY)[1] # Apply OpenCV's threshold function to get binary frame\n\t\tthresh = cv2.dilate(thresh, None, iterations=1) # Dlation to increase white region for surrounding pixels\n\n\t\t# Find contours on thresholded image\n\t\t(cnts, _) = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)\n\n\t\tcontour_area_stack = [] # List of contour areas's values\n\t\tcontour_dictionary = {} # Dictionary of contours key = 'contour area' & value = 'contour coordinates (x,y,w,h)'\n\t\tbiggest_contour_coordinates = None # Biggest contour coordinate\n\n\t\tframe_final_form = cv2.add(frame,mask_white)\n\n\t\t# Loop over the contours\n\t\tif cnts:\n\t\t\tfor c in cnts: # Contour in Contours\n\t\t\t\tcontour_area_stack.append(cv2.contourArea(c)) # Calculate contour area and append to contour stack\n\t\t\t\tif cv2.contourArea(c) > args[\"min_area\"]: # If contour area greater than min area\n\t\t\t\t\t(x, y, w, h) = cv2.boundingRect(c) # Compute the bounding box for this contour\n\t\t\t\t\tcv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2) # Draw it on the frame\n\t\t\t\t\tcontour_dictionary[cv2.contourArea(c)] = (x, y, w, h) # Add a key - value pair to contour dictionary\n\t\t\tdelta_value = max(contour_area_stack) # Assign max contour area to delta value\n\n\t\t\tif contour_dictionary: # If contour dictionary is not empty\n\t\t\t\tbiggest_contour_coordinates = contour_dictionary[delta_value] # Get coordinates of biggest contour\n\n\t\t\tif biggest_contour_coordinates: # If we have the coordinates it means there is a contour in the frame at the same time\n\t\t\t\t# Parse the coordinates\n\t\t\t\tx = biggest_contour_coordinates[0]\n\t\t\t\ty = biggest_contour_coordinates[1]\n\t\t\t\tw = biggest_contour_coordinates[2]\n\t\t\t\th = biggest_contour_coordinates[3]\n\t\t\t\tcv2.rectangle(mask_biggest_contour, (x, y), (x + w, y + h), (255, 255, 255), -1) # Draw only one white rectange\n\n\t\tif delta_value > (height * width / DELTA_LIMIT_DIVISOR): # If delta value is too much\n\t\t\tbreak # Then break\n\n\t\tif len(contour_dictionary) > CONTOUR_LIMIT: # PROBABLY!!! There is a ZOOM, ZOOM + PAN, ZOOM + TILT, ZOOM + ROLL situation (Not just PAN, TILT, ROLL)\n\t\t\t# Then restart angle calculation. This time divide frame to quarters\n\n\t\t\ttotal_crazy_lines = 0 # Crazy line counter\n\t\t\tmost_common_angle1 = None # Most common angle in general optical flow in shot\n\t\t\tangles_array1 = [] # Angle list of all newly created tiny lines\n\t\t\tmost_common_angle2 = None # Most common angle in general optical flow in shot\n\t\t\tangles_array2 = [] # Angle list of all newly created tiny lines\n\t\t\tmost_common_angle3 = None # Most common angle in general optical flow in shot\n\t\t\tangles_array3 = [] # Angle list of all newly created tiny lines\n\t\t\tmost_common_angle4 = None # Most common angle in general optical flow in shot\n\t\t\tangles_array4 = [] # Angle list of all newly created tiny lines\n\t\t\tmask_delta = numpy.zeros_like(old_frame) # Create a mask image for drawing purposes (delta frame)\n\n\t\t\tfor i,(good_point2,good_point1) in enumerate(zip(good_points2,good_points1)): # Get point pairs one by one\n\n\t\t\t\t# Get coordinates of points\n\t\t\t\tx2,y2 = good_point2.ravel() # New point\n\t\t\t\tx1,y1 = good_point1.ravel() # Previous point\n\n\t\t\t\tdistance = math.hypot(x2 - x1, y2 - y1) # Length of the tiny line between these two points.\n\n\t\t\t\tif distance >= CRAZY_LINE_DISTANCE: # If the line is not that \"tiny\" it's CRAZY! xD\n\t\t\t\t\ttotal_crazy_lines += 1 # Then increase total crazy line counter's value\n\n\t\t\t\tangle = math.atan2(y2-y1, x2-x1) # Calculate tangent value of the line (returns Radian)\n\t\t\t\tangle = math.degrees(angle) # Radian to Degree\n\t\t\t\tangle = round(angle) # Round up the degree\n\n\t\t\t\tif (x1 <= (width / 2)) and (y1 <= (height / 2)):\n\t\t\t\t\tangles_array1.append(angle) # Append the degree to Angle List\n\t\t\t\t\tif most_common_angle1 != None: # If there is a most common angle value\n\t\t\t\t\t\tif abs(most_common_angle1 - angle) > ABSDIFF_ANGLE: # If Absolute Difference between most common angle and the current line's angle greater than ABDSDIFF_ANGLE value, this line is inconsistent to current general optical flow\n\t\t\t\t\t\t\tcv2.line(mask_delta, (x2,y2),(x1,y1), white_color, LINE_THICKNESS) # Then draw a white line to mask_delta\n\t\t\t\tif (x1 >= (width / 2)) and (y1 <= (height / 2)):\n\t\t\t\t\tangles_array2.append(angle) # Append the degree to Angle List\n\t\t\t\t\tif most_common_angle2 != None: # If there is a most common angle value\n\t\t\t\t\t\tif abs(most_common_angle2 - angle) > ABSDIFF_ANGLE: # If Absolute Difference between most common angle and the current line's angle greater than ABDSDIFF_ANGLE value, this line is inconsistent to current general optical flow\n\t\t\t\t\t\t\tcv2.line(mask_delta, (x2,y2),(x1,y1), white_color, LINE_THICKNESS) # Then draw a white line to mask_delta\n\t\t\t\tif (x1 <= (width / 2)) and (y1 >= (height / 2)):\n\t\t\t\t\tangles_array3.append(angle) # Append the degree to Angle List\n\t\t\t\t\tif most_common_angle3 != None: # If there is a most common angle value\n\t\t\t\t\t\tif abs(most_common_angle3 - angle) > ABSDIFF_ANGLE: # If Absolute Difference between most common angle and the current line's angle greater than ABDSDIFF_ANGLE value, this line is inconsistent to current general optical flow\n\t\t\t\t\t\t\tcv2.line(mask_delta, (x2,y2),(x1,y1), white_color, LINE_THICKNESS) # Then draw a white line to mask_delta\n\t\t\t\tif (x1 >= (width / 2)) and (y1 >= (height / 2)):\n\t\t\t\t\tangles_array4.append(angle) # Append the degree to Angle List\n\t\t\t\t\tif most_common_angle3 != None: # If there is a most common angle value\n\t\t\t\t\t\tif abs(most_common_angle3 - angle) > ABSDIFF_ANGLE: # If Absolute Difference between most common angle and the current line's angle greater than ABDSDIFF_ANGLE value, this line is inconsistent to current general optical flow\n\t\t\t\t\t\t\tcv2.line(mask_delta, (x2,y2),(x1,y1), white_color, LINE_THICKNESS) # Then draw a white line to mask_delta\n\n\t\t\t\tcv2.line(mask, (x2,y2),(x1,y1), color[i].tolist(), 1) # In every frame draw the colored lines to original frame for better understanding (optional)\n\n\t\t\tif angles_array1: # If angles_array is not empty\n\t\t\t\tmost_common_angle1 = Counter(angles_array1).most_common()[0][0] # Find most common angle value in Angle List\n\t\t\tif angles_array2: # If angles_array is not empty\n\t\t\t\tmost_common_angle2 = Counter(angles_array2).most_common()[0][0] # Find most common angle value in Angle List\n\t\t\tif angles_array3: # If angles_array is not empty\n\t\t\t\tmost_common_angle3 = Counter(angles_array3).most_common()[0][0] # Find most common angle value in Angle List\n\t\t\tif angles_array4: # If angles_array is not empty\n\t\t\t\tmost_common_angle4 = Counter(angles_array4).most_common()[0][0] # Find most common angle value in Angle List\n\n\n\t\t\tmask_delta_gray = cv2.cvtColor(mask_delta, cv2.COLOR_BGR2GRAY) # Convert mask_delta to grayscale\n\t\t\tthresh = cv2.threshold(mask_delta_gray, 12, 255, cv2.THRESH_BINARY)[1] # Apply OpenCV's threshold function to get binary frame\n\t\t\tthresh = cv2.dilate(thresh, None, iterations=1) # Dlation to increase white region for surrounding pixels\n\n\t\t\t# Find contours on thresholded image\n\t\t\t(cnts, _) = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)\n\n\t\t\tcontour_area_stack = [] # List of contour areas's values\n\t\t\tcontour_dictionary = {} # Dictionary of contours key = 'contour area' & value = 'contour coordinates (x,y,w,h)'\n\t\t\tbiggest_contour_coordinates = None # Biggest contour coordinate\n\n\t\t\tframe_final_form = cv2.add(frame,mask_white)\n\n\t\t\t# Loop over the contours\n\t\t\tif cnts:\n\t\t\t\tfor c in cnts: # Contour in Contours\n\t\t\t\t\tcontour_area_stack.append(cv2.contourArea(c)) # Calculate contour area and append to contour stack\n\t\t\t\t\tif cv2.contourArea(c) > args[\"min_area\"]: # If contour area greater than min area\n\t\t\t\t\t\t(x, y, w, h) = cv2.boundingRect(c) # Compute the bounding box for this contour\n\t\t\t\t\t\tcv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2) # Draw it on the frame\n\t\t\t\t\t\tcontour_dictionary[cv2.contourArea(c)] = (x, y, w, h) # Add a key - value pair to contour dictionary\n\t\t\t\tdelta_value = max(contour_area_stack) # Assign max contour area to delta value\n\n\t\t\t\tif contour_dictionary: # If contour dictionary is not empty\n\t\t\t\t\tbiggest_contour_coordinates = contour_dictionary[delta_value] # Get coordinates of biggest contour\n\n\t\t\t\tif biggest_contour_coordinates: # If we have the coordinates it means there is a contour in the frame at the same time\n\t\t\t\t\t# Parse the coordinates\n\t\t\t\t\tx = biggest_contour_coordinates[0]\n\t\t\t\t\ty = biggest_contour_coordinates[1]\n\t\t\t\t\tw = biggest_contour_coordinates[2]\n\t\t\t\t\th = biggest_contour_coordinates[3]\n\t\t\t\t\tcv2.rectangle(mask_biggest_contour, (x, y), (x + w, y + h), (255, 255, 255), -1) # Draw only one white rectange\n\n\t\t\tif delta_value > (height * width / DELTA_LIMIT_DIVISOR): # If delta value is too much\n\t\t\t\tbreak # Then break\n\n\t\telse: # There is just a PAN, TILT, ROLL situation. Don't touch anything.\n\t\t\tpass\n\n\t\tmask_biggest_contour_gray = cv2.cvtColor(mask_biggest_contour, cv2.COLOR_BGR2GRAY) # Convert mask_biggest_contour to grayscale\n\t\tthresh_biggest_contour = cv2.threshold(mask_biggest_contour_gray, 12, 255, cv2.THRESH_BINARY)[1] # Apply OpenCV's threshold function to get binary frame\n\n\t\tthresh_final_form = cv2.bitwise_and(thresh,thresh, mask= thresh_biggest_contour) # Bitwise and - biggest contour and tresh lines\n\t\tthresh_final_form = cv2.dilate(thresh_final_form, None, iterations=1) # Dlation to increase white region for surrounding pixels\n\n\t\tframeDelta = cv2.bitwise_and(frame_final_form,frame_final_form, mask= thresh_final_form) # Bitwise and - to get delta frame\n\n\t\tif total_crazy_lines >= CRAZY_LINE_LIMIT: # If amout of total crazy lines is greater than CRAZY_LINE_LIMIT\n\t\t\tbreak # Break the loop to reconstruct the optical flow\n\n\t\tframe_with_mask = cv2.add(frame,mask) # Add mask layer over frame\n\t\tcv2.imshow('Original Frame',frame_with_mask) # Show Original Frame\n\t\tcv2.imshow('Mask Delta',mask_delta) # Show Mask Delta Frame\n\t\tcv2.imshow('Mask Biggest Contour',mask_biggest_contour) # Show Mask Delta Frame\n\t\tcv2.imshow('Frame Delta',frameDelta) # Show Frame Delta\n\n\t\tk = cv2.waitKey(30) & 0xff # DEVELOPMENT\n\t\tif k == 27: # DEVELOPMENT PRESS ESC\n\t\t\tbreak # DEVELOPMENT BREAK\n\n\t\told_gray = frame_gray.copy() # Update the previous frame\n\t\tp1 = good_points2.reshape(-1,1,2) # Update previous points\n\n\ncv2.destroyAllWindows() # Close any open windows\ncap.release() # Release the capture device\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "most_common_angle1 ", "start_line": 201, "start_column": 4, "end_line": 201, "end_column": 22 }, { "span": "most_common_angle2 ", "start_line": 203, "start_column": 4, "end_line": 203, "end_column": 22 }, { "span": "most_common_angle3 ", "start_line": 205, "start_column": 4, "end_line": 205, "end_column": 22 }, { "span": "most_common_angle4 ", "start_line": 207, "start_column": 4, "end_line": 207, "end_column": 22 } ]
[ { "span": "most_common_angle1 ", "start_line": 152, "start_column": 3, "end_line": 152, "end_column": 21 }, { "span": "most_common_angle2 ", "start_line": 154, "start_column": 3, "end_line": 154, "end_column": 21 }, { "span": "most_common_angle3 ", "start_line": 156, "start_column": 3, "end_line": 156, "end_column": 21 }, { "span": "most_common_angle4 ", "start_line": 158, "start_column": 3, "end_line": 158, "end_column": 21 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "USAGE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "opencv", "-", "optic", "al", "-", "flow", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "opencv", "-", "optic", "al", "-", "flow", ".", "py", " ", "--", "video", " ", "PATH", "/", "example", "\\u", "01", ".", "mp", "4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cv2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "imu", "tils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TRACK", "ER", "\\u", "POINTS_", "=_", "500_", "#", " ", "Ho", "w", " ", "many", " ", "points", " ", "will", " ", "be", " ", "used", " ", "to", " ", "track", " ", "the", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CRA", "ZY", "\\u", "LINE", "\\u", "DISTANCE", "_", "=_", "50_", "#", " ", "Distan", "ce", " ", "value", " ", "to", " ", "detect", " ", "cra", "zy", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CRA", "ZY", "\\u", "LINE", "\\u", "LIMIT_", "=_", "100_", "*_", "TRACK", "ER", "\\u", "POINTS_", "/_", "1000_", "#", " ", "Amo", "unt", " ", "of", " ", "cra", "zy", " ", "lines", " ", "are", " ", "indicati", "on", " ", "of", " ", "different", " ", "shots", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ABS", "DIFF", "\\u", "ANGLE", "_", "=_", "20_", "#", " ", "To", " ", "dete", "rmin", "e", " ", "the", " ", "incon", "siste", "nc", "y", " ", "bet", "ween", " ", "tangent", " ", "values", " ", "in", " ", "degrees_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LINE", "\\u", "THI", "CK", "NESS", "_", "=_", "3_", "#", " ", "Line", "s", " ", "thick", "ness", " ", "tha", "t", " ", "we", " ", "will", " ", "use", " ", "for", " ", "mask", " ", "delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONT", "OUR", "\\u", "LIMIT_", "=_", "10_", "#", " ", "Contour", " ", "limit", " ", "for", " ", "detect", "ing", " ", "ZOO", "M", ",", " ", "ZOO", "M", " ", "+", " ", "PAN", ",", " ", "ZOO", "M", " ", "+", " ", "TI", "LT", ",", " ", "ZOO", "M", " ", "+", " ", "ROLL", " ", "(", "Not", " ", "just", " ", "PAN", ",", " ", "TI", "LT", ",", " ", "ROLL", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TARGET", "\\u", "HEIGHT_", "=_", "360_", "#", " ", "Number", " ", "of", " ", "horizon", "tal", " ", "lines", " ", "for", " ", "target", " ", "video", " ", "and", " ", "process", "ing", ".", " ", "Lik", "e", " ", "720", "p", ",", " ", "360", "p", " ", "etc", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DELTA", "\\u", "LIMIT", "\\u", "DIVI", "SOR", "_", "=_", "3_", "#", " ", "Divis", "or", " ", "for", " ", "detect", "ing", " ", "too", " ", "muc", "h", " ", "moti", "on", ".", " ", "Lik", "e", ":", " ", "(", " ", "height", " ", "*", " ", "widt", "h", " ", "/", " ", "X", " ", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Construct", " ", "the", " ", "argu", "ment", " ", "parser", " ", "and", " ", "parse", " ", "the", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "ap_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ap_", "._", "add", "\\u", "argument_", "(_", "\"-", "v", "\"_", ",_", "\"--", "video", "\"_", ",_", "help_", "=_", "\"", "path", " ", "to", " ", "the", " ", "video", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ap_", "._", "add", "\\u", "argument_", "(_", "\"-", "a", "\"_", ",_", "\"--", "min", "-", "area", "\"_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "500_", ",_", "help_", "=_", "\"", "minim", "um", " ", "area", " ", "size", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "vars_", "(_", "ap_", "._", "parse", "\\u", "args_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "get_", "(_", "\"", "video", "\"_", ",_", "None_", ")_", "is_", "None_", ":_", "#", " ", "If", " ", "the", " ", "video", " ", "argu", "ment", " ", "is", " ", "Non", "e", ",", " ", "then", " ", "we", " ", "are", " ", "readi", "ng", " ", "from", " ", "webca", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "cap_", "=_", "cv2_", "._", "Vid", "eo", "Capture_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "Ot", "her", "wis", "e", ",", " ", "we", " ", "are", " ", "readi", "ng", " ", "from", " ", "a", " ", "video", " ", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "cap_", "=_", "cv2_", "._", "Vid", "eo", "Capture_", "(_", "args_", "[_", "\"", "video", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Parameter", "s", " ", "for", " ", "Luc", "as", " ", "Kan", "ade", " ", "Optic", "al", " ", "Flow_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lk", "\\u", "params_", "=_", "dict_", "(_", "win", "Size_", "=_", "(_", "15_", ",_", "15_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Level_", "=_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "criteria_", "=_", "(_", "cv2_", "._", "TERM", "\\u", "CRIT", "ERI", "A", "\\u", "EPS", "_", "|_", "cv2_", "._", "TERM", "\\u", "CRIT", "ERI", "A", "\\u", "COUNT_", ",_", "10_", ",_", "0.03_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "#", " ", "On", " ", "this", " ", "level", " ", "it", " ", "gets", " ", "only", " ", "one", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "color_", "=_", "numpy_", "._", "random_", "._", "randint_", "(_", "0_", ",_", "255_", ",_", "(_", "TRACK", "ER", "\\u", "POINTS_", ",_", "3_", ")_", ")_", "#", " ", "Creat", "e", " ", "some", " ", "random", " ", "colors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", ",_", "old", "\\u", "frame_", "=_", "cap_", "._", "read_", "(_", ")_", "#", " ", "Tak", "e", " ", "first", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "frame_", "=_", "imu", "tils_", "._", "resize_", "(_", "old", "\\u", "frame_", ",_", "height_", "=_", "TARGET", "\\u", "HEIGHT_", ")_", "#", " ", "Resize", " ", "frame", " ", "to", " ", "360", "p", ".", " ", "Alternative", " ", "resiz", "ing", " ", "method", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "gray_", "=_", "cv2_", "._", "cvt", "Color_", "(_", "old", "\\u", "frame_", ",_", "cv2_", "._", "COLOR", "\\u", "BG", "R2", "GRAY_", ")_", "#", " ", "Convert", " ", "previ", "ous", " ", "frame", " ", "to", " ", "grayscale", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "height_", ",_", "width_", "=_", "old", "\\u", "frame_", "._", "shape_", "[_", ":_", "2_", "]_", "#", " ", "Get", " ", "video", " ", "height", " ", "and", " ", "widt", "h", " ", "(", "size", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "random", " ", "points", " ", "on", " ", "frame_", "\\u\\u\\uNL\\u\\u\\u_", "p1_", "=_", "numpy_", "._", "random_", "._", "randint_", "(_", "width_", ",_", "size_", "=_", "(_", "TRACK", "ER", "\\u", "POINTS_", ",_", "1_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "y_", "in_", "p1_", ":_", "#", " ", "Get", " ", "y", " ", "values", " ", "one", " ", "by", " ", "one_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t", " _", "if_", "y_", "[_", "0_", "]_", "[_", "1_", "]_", ">_", "height_", ":_", "#", " ", "If", " ", "there", " ", "is", " ", "a", " ", "y", " ", "value", " ", "tha", "t", " ", "great", "er", " ", "than", " ", "max", " ", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t", "\t", " _", "y_", "[_", "0_", "]_", "[_", "1_", "]_", "=_", "numpy_", "._", "random_", "._", "random", "\\u", "integers_", "(_", "height_", ")_", "#", " ", "Random", " ", "again", " ", "this", " ", "time", " ", "with", " ", "max", " ", "height", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p1_", "=_", "p1_", "._", "astype_", "(_", "numpy_", "._", "float32_", ")_", "#", " ", "Change", " ", "nump", "y", " ", "array", "'", "s", " ", "data", " ", "type", " ", "to", " ", "float32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mask_", "=_", "numpy_", "._", "zero", "s", "\\u", "like_", "(_", "old", "\\u", "frame_", ")_", "#", " ", "Creat", "e", " ", "a", " ", "mask", " ", "image", " ", "for", " ", "drawing", " ", "purpose", "s", " ", "(", "original", " ", "frame", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "delta_", "=_", "numpy_", "._", "zero", "s", "\\u", "like_", "(_", "old", "\\u", "frame_", ")_", "#", " ", "Creat", "e", " ", "a", " ", "mask", " ", "image", " ", "for", " ", "drawing", " ", "purpose", "s", " ", "(", "delta", " ", "frame", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "white_", "=_", "numpy_", "._", "ones", "\\u", "like_", "(_", "old", "\\u", "frame_", ")_", "#", " ", "Creat", "e", " ", "a", " ", "white", " ", "mask", " ", "image", " ", "for", " ", "clo", "ning", " ", "original", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "white", "\\u", "color_", "=_", "numpy_", "._", "array_", "(_", "[_", "255_", ",_", "255_", ",_", "255_", "]_", ")_", "#", " ", "Define", " ", "color", " ", "white_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "total", "\\u", "cra", "zy", "\\u", "lines_", "=_", "0_", "#", " ", "Cra", "zy", " ", "line", " ", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "most", "\\u", "common", "\\u", "angle_", "=_", "None_", "#", " ", "Mos", "t", " ", "common", " ", "angle", " ", "in", " ", "genera", "l", " ", "optic", "al", " ", "flow", " ", "in", " ", "shot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "#", " ", "Loop", " ", "over", " ", "the", " ", "frames", " ", "of", " ", "the", " ", "video_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "mask", "\\u", "bigge", "st", "\\u", "contour_", "=_", "numpy_", "._", "zero", "s", "\\u", "like_", "(_", "old", "\\u", "frame_", ")_", "#", " ", "Creat", "e", " ", "a", " ", "mask", " ", "image", " ", "for", " ", "drawing", " ", "purpose", "s", " ", "(", "bigge", "st", " ", "conto", "ur", " ", "frame", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", ",_", "frame_", "=_", "cap_", "._", "read_", "(_", ")_", "#", " ", "Tak", "e", " ", "a", " ", "new", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame_", "=_", "imu", "tils_", "._", "resize_", "(_", "frame_", ",_", "height_", "=_", "TARGET", "\\u", "HEIGHT_", ")_", "#", " ", "Resize", " ", "frame", " ", "to", " ", "360", "p", ".", " ", "Alternative", " ", "resiz", "ing", " ", "method", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "\\u", "gray_", "=_", "cv2_", "._", "cvt", "Color_", "(_", "frame_", ",_", "cv2_", "._", "COLOR", "\\u", "BG", "R2", "GRAY_", ")_", "#", " ", "Convert", " ", "it", " ", "to", " ", "grayscale", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "delta", "\\u", "value_", "=_", "0_", "#", " ", "Del", "ta", " ", "Value", " ", "for", " ", "stor", "ing", " ", "max", " ", "continuous", " ", "conto", "ur", " ", "area", " ", "for", " ", "current", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p2_", ",_", "st_", ",_", "err_", "=_", "cv2_", "._", "calc", "Optic", "al", "Flow", "Pyr", "LK", "_", "(_", "old", "\\u", "gray_", ",_", "frame", "\\u", "gray_", ",_", "p1_", ",_", "None_", ",_", "**_", "lk", "\\u", "params_", ")_", "#", " ", "Calculat", "e", " ", "optic", "al", " ", "flow", " ", "(", "Luc", "as", " ", "Kan", "ade", " ", "Optic", "al", " ", "Flow", " ", "function", " ", "of", " ", "Open", "CV", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "p2_", "is_", "None_", ":_", "#", " ", "If", " ", "there", " ", "are", " ", "not", " ", "any", " ", "points", " ", "tha", "t", " ", "comi", "ng", " ", "from", " ", "Luc", "as", " ", "Kan", "ade", " ", "Optic", "al", " ", "Flow", " ", "function", " ", "of", " ", "Open", "CV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "break_", "#", " ", "Break", " ", "the", " ", "loop", " ", "to", " ", "reconstruct", " ", "the", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Select", " ", "good", " ", "points_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "good", "\\u", "points", "2_", "=_", "p2_", "[_", "st_", "==_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "good", "\\u", "points", "1_", "=_", "p1_", "[_", "st_", "==_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "angle", "s", "\\u", "array_", "=_", "[_", "]_", "#", " ", "Ang", "le", " ", "list", " ", "of", " ", "all", " ", "newl", "y", " ", "created", " ", "tiny", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "(_", "good", "\\u", "point2_", ",_", "good", "\\u", "point1_", ")_", "in_", "enumerate_", "(_", "zip_", "(_", "good", "\\u", "points", "2_", ",_", "good", "\\u", "points", "1_", ")_", ")_", ":_", "#", " ", "Get", " ", "point", " ", "pair", "s", " ", "one", " ", "by", " ", "one_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "coordinate", "s", " ", "of", " ", "points_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "x2_", ",_", "y2_", "=_", "good", "\\u", "point2_", "._", "ravel_", "(_", ")_", "#", " ", "New", " ", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x1_", ",_", "y1_", "=_", "good", "\\u", "point1_", "._", "ravel_", "(_", ")_", "#", " ", "Prev", "ious", " ", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "distance_", "=_", "math_", "._", "hypot", "_", "(_", "x2_", "-_", "x1_", ",_", "y2_", "-_", "y1_", ")_", "#", " ", "Length", " ", "of", " ", "the", " ", "tiny", " ", "line", " ", "bet", "ween", " ", "these", " ", "two", " ", "points", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "distance_", ">=_", "CRA", "ZY", "\\u", "LINE", "\\u", "DISTANCE", "_", ":_", "#", " ", "If", " ", "the", " ", "line", " ", "is", " ", "not", " ", "tha", "t", " ", "\"", "tiny", "\"", " ", "it", "'", "s", " ", "CRA", "ZY", "!", " ", "x", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "total", "\\u", "cra", "zy", "\\u", "lines_", "+=_", "1_", "#", " ", "The", "n", " ", "increase", " ", "total", " ", "cra", "zy", " ", "line", " ", "counter", "'", "s", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "angle_", "=_", "math_", "._", "atan2_", "(_", "y2_", "-_", "y1_", ",_", "x2_", "-_", "x1_", ")_", "#", " ", "Calculat", "e", " ", "tangent", " ", "value", " ", "of", " ", "the", " ", "line", " ", "(", "return", "s", " ", "Radia", "n", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle_", "=_", "math_", "._", "degrees_", "(_", "angle_", ")_", "#", " ", "Radia", "n", " ", "to", " ", "Deg", "ree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle_", "=_", "round_", "(_", "angle_", ")_", "#", " ", "Round", " ", "up", " ", "the", " ", "degree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle", "s", "\\u", "array_", "._", "append_", "(_", "angle_", ")_", "#", " ", "Append", " ", "the", " ", "degr", "ee", " ", "to", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "most", "\\u", "common", "\\u", "angle_", "!=_", "None_", ":_", "#", " ", "If", " ", "there", " ", "is", " ", "a", " ", "most", " ", "common", " ", "angle", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "abs_", "(_", "most", "\\u", "common", "\\u", "angle_", "-_", "angle_", ")_", ">_", "ABS", "DIFF", "\\u", "ANGLE", "_", ":_", "#", " ", "If", " ", "Abs", "olute", " ", "Difference", " ", "bet", "ween", " ", "most", " ", "common", " ", "angle", " ", "and", " ", "the", " ", "current", " ", "line", "'", "s", " ", "angle", " ", "great", "er", " ", "than", " ", "AB", "DS", "DIFF", "\\u", "ANGLE", " ", "value", ",", " ", "this", " ", "line", " ", "is", " ", "inconsistent", " ", "to", " ", "current", " ", "genera", "l", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "cv2_", "._", "line_", "(_", "mask", "\\u", "delta_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "white", "\\u", "color_", ",_", "LINE", "\\u", "THI", "CK", "NESS", "_", ")_", "#", " ", "The", "n", " ", "draw", " ", "a", " ", "white", " ", "line", " ", "to", " ", "mask", "\\u", "delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cv2_", "._", "line_", "(_", "mask_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "color_", "[_", "i_", "]_", "._", "tolist_", "(_", ")_", ",_", "1_", ")_", "#", " ", "In", " ", "every", " ", "frame", " ", "draw", " ", "the", " ", "colore", "d", " ", "lines", " ", "to", " ", "original", " ", "frame", " ", "for", " ", "bett", "er", " ", "underst", "and", "ing", " ", "(", "option", "al", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "angle", "s", "\\u", "array_", ":_", "#", " ", "If", " ", "angle", "s", "\\u", "array", " ", "is", " ", "not", " ", "empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "most", "\\u", "common", "\\u", "angle_", "=_", "Counter_", "(_", "angle", "s", "\\u", "array_", ")_", "._", "most", "\\u", "common_", "(_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "#", " ", "Fin", "d", " ", "most", " ", "common", " ", "angle", " ", "value", " ", "in", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask", "\\u", "delta", "\\u", "gray_", "=_", "cv2_", "._", "cvt", "Color_", "(_", "mask", "\\u", "delta_", ",_", "cv2_", "._", "COLOR", "\\u", "BG", "R2", "GRAY_", ")_", "#", " ", "Convert", " ", "mask", "\\u", "delta", " ", "to", " ", "grayscale", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thresh_", "=_", "cv2_", "._", "threshold_", "(_", "mask", "\\u", "delta", "\\u", "gray_", ",_", "12_", ",_", "255_", ",_", "cv2_", "._", "THRESH", "\\u", "BINARY_", ")_", "[_", "1_", "]_", "#", " ", "Apply", " ", "Open", "CV", "'", "s", " ", "threshol", "d", " ", "function", " ", "to", " ", "get", " ", "binar", "y", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thresh_", "=_", "cv2_", "._", "dilate", "_", "(_", "thresh_", ",_", "None_", ",_", "iterations_", "=_", "1_", ")_", "#", " ", "Dl", "ation", " ", "to", " ", "increase", " ", "white", " ", "region", " ", "for", " ", "surround", "ing", " ", "pixels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "contours", " ", "on", " ", "threshol", "ded", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "cnt", "s_", ",_", "\\u_", ")_", "=_", "cv2_", "._", "find", "Contours", "_", "(_", "thresh_", "._", "copy_", "(_", ")_", ",_", "cv2_", "._", "RET", "R", "\\u", "EXTERNAL", "_", ",_", "cv2_", "._", "CHAIN", "\\u", "APPRO", "X", "\\u", "SIMPLE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conto", "ur\\u", "area", "\\u", "stack_", "=_", "[_", "]_", "#", " ", "List", " ", "of", " ", "conto", "ur", " ", "area", "s", "'", "s", " ", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conto", "ur\\u", "dictionary_", "=_", "{_", "}_", "#", " ", "Dict", "ionar", "y", " ", "of", " ", "contours", " ", "key", " ", "=", " ", "'", "conto", "ur", " ", "area", "'", " ", "&", " ", "value", " ", "=", " ", "'", "conto", "ur", " ", "coordinate", "s", " ", "(", "x", ",", "y", ",", "w", ",", "h", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "=_", "None_", "#", " ", "Big", "gest", " ", "conto", "ur", " ", "coordinate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "\\u", "final", "\\u", "form_", "=_", "cv2_", "._", "add_", "(_", "frame_", ",_", "mask", "\\u", "white_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "the", " ", "contours_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cnt", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "c_", "in_", "cnt", "s_", ":_", "#", " ", "Contour", " ", "in", " ", "Contours", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "conto", "ur\\u", "area", "\\u", "stack_", "._", "append_", "(_", "cv2_", "._", "conto", "ur", "Area_", "(_", "c_", ")_", ")_", "#", " ", "Calculat", "e", " ", "conto", "ur", " ", "area", " ", "and", " ", "append", " ", "to", " ", "conto", "ur", " ", "stack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cv2_", "._", "conto", "ur", "Area_", "(_", "c_", ")_", ">_", "args_", "[_", "\"", "min", "\\u", "area", "\"_", "]_", ":_", "#", " ", "If", " ", "conto", "ur", " ", "area", " ", "great", "er", " ", "than", " ", "min", " ", "area_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "(_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", ")_", "=_", "cv2_", "._", "bound", "ing", "Rect_", "(_", "c_", ")_", "#", " ", "Compute", " ", "the", " ", "bound", "ing", " ", "box", " ", "for", " ", "this", " ", "contour_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "rectangle_", "(_", "frame_", ",_", "(_", "x_", ",_", "y_", ")_", ",_", "(_", "x_", "+_", "w_", ",_", "y_", "+_", "h_", ")_", ",_", "(_", "0_", ",_", "255_", ",_", "0_", ")_", ",_", "2_", ")_", "#", " ", "Draw", " ", "it", " ", "on", " ", "the", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conto", "ur\\u", "dictionary_", "[_", "cv2_", "._", "conto", "ur", "Area_", "(_", "c_", ")_", "]_", "=_", "(_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", ")_", "#", " ", "Add", " ", "a", " ", "key", " ", "-", " ", "value", " ", "pair", " ", "to", " ", "conto", "ur", " ", "dictionary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delta", "\\u", "value_", "=_", "max_", "(_", "conto", "ur\\u", "area", "\\u", "stack_", ")_", "#", " ", "Assign", " ", "max", " ", "conto", "ur", " ", "area", " ", "to", " ", "delta", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "conto", "ur\\u", "dictionary_", ":_", "#", " ", "If", " ", "conto", "ur", " ", "dictionar", "y", " ", "is", " ", "not", " ", "empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "=_", "conto", "ur\\u", "dictionary_", "[_", "delta", "\\u", "value_", "]_", "#", " ", "Get", " ", "coordinate", "s", " ", "of", " ", "bigge", "st", " ", "contour_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", ":_", "#", " ", "If", " ", "we", " ", "have", " ", "the", " ", "coordinate", "s", " ", "it", " ", "means", " ", "there", " ", "is", " ", "a", " ", "conto", "ur", " ", "in", " ", "the", " ", "frame", " ", "at", " ", "the", " ", "same", " ", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pars", "e", " ", "the", " ", "coordinates_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "x_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "rectangle_", "(_", "mask", "\\u", "bigge", "st", "\\u", "contour_", ",_", "(_", "x_", ",_", "y_", ")_", ",_", "(_", "x_", "+_", "w_", ",_", "y_", "+_", "h_", ")_", ",_", "(_", "255_", ",_", "255_", ",_", "255_", ")_", ",_", "-_", "1_", ")_", "#", " ", "Draw", " ", "only", " ", "one", " ", "white", " ", "rect", "ange_", "\\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_", "delta", "\\u", "value_", ">_", "(_", "height_", "*_", "width_", "/_", "DELTA", "\\u", "LIMIT", "\\u", "DIVI", "SOR", "_", ")_", ":_", "#", " ", "If", " ", "delta", " ", "value", " ", "is", " ", "too", " ", "muc", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "break_", "#", " ", "The", "n", " ", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "conto", "ur\\u", "dictionary_", ")_", ">_", "CONT", "OUR", "\\u", "LIMIT_", ":_", "#", " ", "PROB", "AB", "LY", "!!!", " ", "There", " ", "is", " ", "a", " ", "ZOO", "M", ",", " ", "ZOO", "M", " ", "+", " ", "PAN", ",", " ", "ZOO", "M", " ", "+", " ", "TI", "LT", ",", " ", "ZOO", "M", " ", "+", " ", "ROLL", " ", "situation", " ", "(", "Not", " ", "just", " ", "PAN", ",", " ", "TI", "LT", ",", " ", "ROLL", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", "n", " ", "restart", " ", "angle", " ", "calculati", "on", ".", " ", "Thi", "s", " ", "time", " ", "divide", " ", "frame", " ", "to", " ", "quarter", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "total", "\\u", "cra", "zy", "\\u", "lines_", "=_", "0_", "#", " ", "Cra", "zy", " ", "line", " ", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "most", "\\u", "common", "\\u", "angle", "1_", "=_", "None_", "#", " ", "Mos", "t", " ", "common", " ", "angle", " ", "in", " ", "genera", "l", " ", "optic", "al", " ", "flow", " ", "in", " ", "shot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle", "s", "\\u", "array", "1_", "=_", "[_", "]_", "#", " ", "Ang", "le", " ", "list", " ", "of", " ", "all", " ", "newl", "y", " ", "created", " ", "tiny", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "most", "\\u", "common", "\\u", "angle", "2_", "=_", "None_", "#", " ", "Mos", "t", " ", "common", " ", "angle", " ", "in", " ", "genera", "l", " ", "optic", "al", " ", "flow", " ", "in", " ", "shot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle", "s", "\\u", "array", "2_", "=_", "[_", "]_", "#", " ", "Ang", "le", " ", "list", " ", "of", " ", "all", " ", "newl", "y", " ", "created", " ", "tiny", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "most", "\\u", "common", "\\u", "angle", "3_", "=_", "None_", "#", " ", "Mos", "t", " ", "common", " ", "angle", " ", "in", " ", "genera", "l", " ", "optic", "al", " ", "flow", " ", "in", " ", "shot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle", "s", "\\u", "array", "3_", "=_", "[_", "]_", "#", " ", "Ang", "le", " ", "list", " ", "of", " ", "all", " ", "newl", "y", " ", "created", " ", "tiny", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "most", "\\u", "common", "\\u", "angle", "4_", "=_", "None_", "#", " ", "Mos", "t", " ", "common", " ", "angle", " ", "in", " ", "genera", "l", " ", "optic", "al", " ", "flow", " ", "in", " ", "shot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle", "s", "\\u", "array", "4_", "=_", "[_", "]_", "#", " ", "Ang", "le", " ", "list", " ", "of", " ", "all", " ", "newl", "y", " ", "created", " ", "tiny", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "delta_", "=_", "numpy_", "._", "zero", "s", "\\u", "like_", "(_", "old", "\\u", "frame_", ")_", "#", " ", "Creat", "e", " ", "a", " ", "mask", " ", "image", " ", "for", " ", "drawing", " ", "purpose", "s", " ", "(", "delta", " ", "frame", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "(_", "good", "\\u", "point2_", ",_", "good", "\\u", "point1_", ")_", "in_", "enumerate_", "(_", "zip_", "(_", "good", "\\u", "points", "2_", ",_", "good", "\\u", "points", "1_", ")_", ")_", ":_", "#", " ", "Get", " ", "point", " ", "pair", "s", " ", "one", " ", "by", " ", "one_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "coordinate", "s", " ", "of", " ", "points_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "x2_", ",_", "y2_", "=_", "good", "\\u", "point2_", "._", "ravel_", "(_", ")_", "#", " ", "New", " ", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x1_", ",_", "y1_", "=_", "good", "\\u", "point1_", "._", "ravel_", "(_", ")_", "#", " ", "Prev", "ious", " ", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "distance_", "=_", "math_", "._", "hypot", "_", "(_", "x2_", "-_", "x1_", ",_", "y2_", "-_", "y1_", ")_", "#", " ", "Length", " ", "of", " ", "the", " ", "tiny", " ", "line", " ", "bet", "ween", " ", "these", " ", "two", " ", "points", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "distance_", ">=_", "CRA", "ZY", "\\u", "LINE", "\\u", "DISTANCE", "_", ":_", "#", " ", "If", " ", "the", " ", "line", " ", "is", " ", "not", " ", "tha", "t", " ", "\"", "tiny", "\"", " ", "it", "'", "s", " ", "CRA", "ZY", "!", " ", "x", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "total", "\\u", "cra", "zy", "\\u", "lines_", "+=_", "1_", "#", " ", "The", "n", " ", "increase", " ", "total", " ", "cra", "zy", " ", "line", " ", "counter", "'", "s", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "angle_", "=_", "math_", "._", "atan2_", "(_", "y2_", "-_", "y1_", ",_", "x2_", "-_", "x1_", ")_", "#", " ", "Calculat", "e", " ", "tangent", " ", "value", " ", "of", " ", "the", " ", "line", " ", "(", "return", "s", " ", "Radia", "n", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle_", "=_", "math_", "._", "degrees_", "(_", "angle_", ")_", "#", " ", "Radia", "n", " ", "to", " ", "Deg", "ree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle_", "=_", "round_", "(_", "angle_", ")_", "#", " ", "Round", " ", "up", " ", "the", " ", "degree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "x1_", "<=_", "(_", "width_", "/_", "2_", ")_", ")_", "and_", "(_", "y1_", "<=_", "(_", "height_", "/_", "2_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "angle", "s", "\\u", "array", "1_", "._", "append_", "(_", "angle_", ")_", "#", " ", "Append", " ", "the", " ", "degr", "ee", " ", "to", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "most", "\\u", "common", "\\u", "angle", "1_", "!=_", "None_", ":_", "#", " ", "If", " ", "there", " ", "is", " ", "a", " ", "most", " ", "common", " ", "angle", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "if_", "abs_", "(_", "most", "\\u", "common", "\\u", "angle", "1_", "-_", "angle_", ")_", ">_", "ABS", "DIFF", "\\u", "ANGLE", "_", ":_", "#", " ", "If", " ", "Abs", "olute", " ", "Difference", " ", "bet", "ween", " ", "most", " ", "common", " ", "angle", " ", "and", " ", "the", " ", "current", " ", "line", "'", "s", " ", "angle", " ", "great", "er", " ", "than", " ", "AB", "DS", "DIFF", "\\u", "ANGLE", " ", "value", ",", " ", "this", " ", "line", " ", "is", " ", "inconsistent", " ", "to", " ", "current", " ", "genera", "l", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "cv2_", "._", "line_", "(_", "mask", "\\u", "delta_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "white", "\\u", "color_", ",_", "LINE", "\\u", "THI", "CK", "NESS", "_", ")_", "#", " ", "The", "n", " ", "draw", " ", "a", " ", "white", " ", "line", " ", "to", " ", "mask", "\\u", "delta_", "\\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_", "(_", "x1_", ">=_", "(_", "width_", "/_", "2_", ")_", ")_", "and_", "(_", "y1_", "<=_", "(_", "height_", "/_", "2_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "angle", "s", "\\u", "array", "2_", "._", "append_", "(_", "angle_", ")_", "#", " ", "Append", " ", "the", " ", "degr", "ee", " ", "to", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "most", "\\u", "common", "\\u", "angle", "2_", "!=_", "None_", ":_", "#", " ", "If", " ", "there", " ", "is", " ", "a", " ", "most", " ", "common", " ", "angle", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "if_", "abs_", "(_", "most", "\\u", "common", "\\u", "angle", "2_", "-_", "angle_", ")_", ">_", "ABS", "DIFF", "\\u", "ANGLE", "_", ":_", "#", " ", "If", " ", "Abs", "olute", " ", "Difference", " ", "bet", "ween", " ", "most", " ", "common", " ", "angle", " ", "and", " ", "the", " ", "current", " ", "line", "'", "s", " ", "angle", " ", "great", "er", " ", "than", " ", "AB", "DS", "DIFF", "\\u", "ANGLE", " ", "value", ",", " ", "this", " ", "line", " ", "is", " ", "inconsistent", " ", "to", " ", "current", " ", "genera", "l", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "cv2_", "._", "line_", "(_", "mask", "\\u", "delta_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "white", "\\u", "color_", ",_", "LINE", "\\u", "THI", "CK", "NESS", "_", ")_", "#", " ", "The", "n", " ", "draw", " ", "a", " ", "white", " ", "line", " ", "to", " ", "mask", "\\u", "delta_", "\\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_", "(_", "x1_", "<=_", "(_", "width_", "/_", "2_", ")_", ")_", "and_", "(_", "y1_", ">=_", "(_", "height_", "/_", "2_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "angle", "s", "\\u", "array", "3_", "._", "append_", "(_", "angle_", ")_", "#", " ", "Append", " ", "the", " ", "degr", "ee", " ", "to", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "most", "\\u", "common", "\\u", "angle", "3_", "!=_", "None_", ":_", "#", " ", "If", " ", "there", " ", "is", " ", "a", " ", "most", " ", "common", " ", "angle", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "if_", "abs_", "(_", "most", "\\u", "common", "\\u", "angle", "3_", "-_", "angle_", ")_", ">_", "ABS", "DIFF", "\\u", "ANGLE", "_", ":_", "#", " ", "If", " ", "Abs", "olute", " ", "Difference", " ", "bet", "ween", " ", "most", " ", "common", " ", "angle", " ", "and", " ", "the", " ", "current", " ", "line", "'", "s", " ", "angle", " ", "great", "er", " ", "than", " ", "AB", "DS", "DIFF", "\\u", "ANGLE", " ", "value", ",", " ", "this", " ", "line", " ", "is", " ", "inconsistent", " ", "to", " ", "current", " ", "genera", "l", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "cv2_", "._", "line_", "(_", "mask", "\\u", "delta_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "white", "\\u", "color_", ",_", "LINE", "\\u", "THI", "CK", "NESS", "_", ")_", "#", " ", "The", "n", " ", "draw", " ", "a", " ", "white", " ", "line", " ", "to", " ", "mask", "\\u", "delta_", "\\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_", "(_", "x1_", ">=_", "(_", "width_", "/_", "2_", ")_", ")_", "and_", "(_", "y1_", ">=_", "(_", "height_", "/_", "2_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "angle", "s", "\\u", "array", "4_", "._", "append_", "(_", "angle_", ")_", "#", " ", "Append", " ", "the", " ", "degr", "ee", " ", "to", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "most", "\\u", "common", "\\u", "angle", "3_", "!=_", "None_", ":_", "#", " ", "If", " ", "there", " ", "is", " ", "a", " ", "most", " ", "common", " ", "angle", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "if_", "abs_", "(_", "most", "\\u", "common", "\\u", "angle", "3_", "-_", "angle_", ")_", ">_", "ABS", "DIFF", "\\u", "ANGLE", "_", ":_", "#", " ", "If", " ", "Abs", "olute", " ", "Difference", " ", "bet", "ween", " ", "most", " ", "common", " ", "angle", " ", "and", " ", "the", " ", "current", " ", "line", "'", "s", " ", "angle", " ", "great", "er", " ", "than", " ", "AB", "DS", "DIFF", "\\u", "ANGLE", " ", "value", ",", " ", "this", " ", "line", " ", "is", " ", "inconsistent", " ", "to", " ", "current", " ", "genera", "l", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "cv2_", "._", "line_", "(_", "mask", "\\u", "delta_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "white", "\\u", "color_", ",_", "LINE", "\\u", "THI", "CK", "NESS", "_", ")_", "#", " ", "The", "n", " ", "draw", " ", "a", " ", "white", " ", "line", " ", "to", " ", "mask", "\\u", "delta_", "\\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_", "cv2_", "._", "line_", "(_", "mask_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "color_", "[_", "i_", "]_", "._", "tolist_", "(_", ")_", ",_", "1_", ")_", "#", " ", "In", " ", "every", " ", "frame", " ", "draw", " ", "the", " ", "colore", "d", " ", "lines", " ", "to", " ", "original", " ", "frame", " ", "for", " ", "bett", "er", " ", "underst", "and", "ing", " ", "(", "option", "al", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "angle", "s", "\\u", "array", "1_", ":_", "#", " ", "If", " ", "angle", "s", "\\u", "array", " ", "is", " ", "not", " ", "empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "most", "\\u", "common", "\\u", "angle", "1_", "=_", "Counter_", "(_", "angle", "s", "\\u", "array", "1_", ")_", "._", "most", "\\u", "common_", "(_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "#", " ", "Fin", "d", " ", "most", " ", "common", " ", "angle", " ", "value", " ", "in", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "angle", "s", "\\u", "array", "2_", ":_", "#", " ", "If", " ", "angle", "s", "\\u", "array", " ", "is", " ", "not", " ", "empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "most", "\\u", "common", "\\u", "angle", "2_", "=_", "Counter_", "(_", "angle", "s", "\\u", "array", "2_", ")_", "._", "most", "\\u", "common_", "(_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "#", " ", "Fin", "d", " ", "most", " ", "common", " ", "angle", " ", "value", " ", "in", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "angle", "s", "\\u", "array", "3_", ":_", "#", " ", "If", " ", "angle", "s", "\\u", "array", " ", "is", " ", "not", " ", "empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "most", "\\u", "common", "\\u", "angle", "3_", "=_", "Counter_", "(_", "angle", "s", "\\u", "array", "3_", ")_", "._", "most", "\\u", "common_", "(_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "#", " ", "Fin", "d", " ", "most", " ", "common", " ", "angle", " ", "value", " ", "in", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "angle", "s", "\\u", "array", "4_", ":_", "#", " ", "If", " ", "angle", "s", "\\u", "array", " ", "is", " ", "not", " ", "empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "most", "\\u", "common", "\\u", "angle", "4_", "=_", "Counter_", "(_", "angle", "s", "\\u", "array", "4_", ")_", "._", "most", "\\u", "common_", "(_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "#", " ", "Fin", "d", " ", "most", " ", "common", " ", "angle", " ", "value", " ", "in", " ", "Ang", "le", " ", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask", "\\u", "delta", "\\u", "gray_", "=_", "cv2_", "._", "cvt", "Color_", "(_", "mask", "\\u", "delta_", ",_", "cv2_", "._", "COLOR", "\\u", "BG", "R2", "GRAY_", ")_", "#", " ", "Convert", " ", "mask", "\\u", "delta", " ", "to", " ", "grayscale", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thresh_", "=_", "cv2_", "._", "threshold_", "(_", "mask", "\\u", "delta", "\\u", "gray_", ",_", "12_", ",_", "255_", ",_", "cv2_", "._", "THRESH", "\\u", "BINARY_", ")_", "[_", "1_", "]_", "#", " ", "Apply", " ", "Open", "CV", "'", "s", " ", "threshol", "d", " ", "function", " ", "to", " ", "get", " ", "binar", "y", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thresh_", "=_", "cv2_", "._", "dilate", "_", "(_", "thresh_", ",_", "None_", ",_", "iterations_", "=_", "1_", ")_", "#", " ", "Dl", "ation", " ", "to", " ", "increase", " ", "white", " ", "region", " ", "for", " ", "surround", "ing", " ", "pixels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "contours", " ", "on", " ", "threshol", "ded", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "cnt", "s_", ",_", "\\u_", ")_", "=_", "cv2_", "._", "find", "Contours", "_", "(_", "thresh_", "._", "copy_", "(_", ")_", ",_", "cv2_", "._", "RET", "R", "\\u", "EXTERNAL", "_", ",_", "cv2_", "._", "CHAIN", "\\u", "APPRO", "X", "\\u", "SIMPLE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conto", "ur\\u", "area", "\\u", "stack_", "=_", "[_", "]_", "#", " ", "List", " ", "of", " ", "conto", "ur", " ", "area", "s", "'", "s", " ", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conto", "ur\\u", "dictionary_", "=_", "{_", "}_", "#", " ", "Dict", "ionar", "y", " ", "of", " ", "contours", " ", "key", " ", "=", " ", "'", "conto", "ur", " ", "area", "'", " ", "&", " ", "value", " ", "=", " ", "'", "conto", "ur", " ", "coordinate", "s", " ", "(", "x", ",", "y", ",", "w", ",", "h", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "=_", "None_", "#", " ", "Big", "gest", " ", "conto", "ur", " ", "coordinate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "\\u", "final", "\\u", "form_", "=_", "cv2_", "._", "add_", "(_", "frame_", ",_", "mask", "\\u", "white_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "the", " ", "contours_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cnt", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "for_", "c_", "in_", "cnt", "s_", ":_", "#", " ", "Contour", " ", "in", " ", "Contours", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "conto", "ur\\u", "area", "\\u", "stack_", "._", "append_", "(_", "cv2_", "._", "conto", "ur", "Area_", "(_", "c_", ")_", ")_", "#", " ", "Calculat", "e", " ", "conto", "ur", " ", "area", " ", "and", " ", "append", " ", "to", " ", "conto", "ur", " ", "stack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cv2_", "._", "conto", "ur", "Area_", "(_", "c_", ")_", ">_", "args_", "[_", "\"", "min", "\\u", "area", "\"_", "]_", ":_", "#", " ", "If", " ", "conto", "ur", " ", "area", " ", "great", "er", " ", "than", " ", "min", " ", "area_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "(_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", ")_", "=_", "cv2_", "._", "bound", "ing", "Rect_", "(_", "c_", ")_", "#", " ", "Compute", " ", "the", " ", "bound", "ing", " ", "box", " ", "for", " ", "this", " ", "contour_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "rectangle_", "(_", "frame_", ",_", "(_", "x_", ",_", "y_", ")_", ",_", "(_", "x_", "+_", "w_", ",_", "y_", "+_", "h_", ")_", ",_", "(_", "0_", ",_", "255_", ",_", "0_", ")_", ",_", "2_", ")_", "#", " ", "Draw", " ", "it", " ", "on", " ", "the", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conto", "ur\\u", "dictionary_", "[_", "cv2_", "._", "conto", "ur", "Area_", "(_", "c_", ")_", "]_", "=_", "(_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", ")_", "#", " ", "Add", " ", "a", " ", "key", " ", "-", " ", "value", " ", "pair", " ", "to", " ", "conto", "ur", " ", "dictionary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delta", "\\u", "value_", "=_", "max_", "(_", "conto", "ur\\u", "area", "\\u", "stack_", ")_", "#", " ", "Assign", " ", "max", " ", "conto", "ur", " ", "area", " ", "to", " ", "delta", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "conto", "ur\\u", "dictionary_", ":_", "#", " ", "If", " ", "conto", "ur", " ", "dictionar", "y", " ", "is", " ", "not", " ", "empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "=_", "conto", "ur\\u", "dictionary_", "[_", "delta", "\\u", "value_", "]_", "#", " ", "Get", " ", "coordinate", "s", " ", "of", " ", "bigge", "st", " ", "contour_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", ":_", "#", " ", "If", " ", "we", " ", "have", " ", "the", " ", "coordinate", "s", " ", "it", " ", "means", " ", "there", " ", "is", " ", "a", " ", "conto", "ur", " ", "in", " ", "the", " ", "frame", " ", "at", " ", "the", " ", "same", " ", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pars", "e", " ", "the", " ", "coordinates_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "x_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "bigge", "st", "\\u", "conto", "ur\\u", "coordinates_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "rectangle_", "(_", "mask", "\\u", "bigge", "st", "\\u", "contour_", ",_", "(_", "x_", ",_", "y_", ")_", ",_", "(_", "x_", "+_", "w_", ",_", "y_", "+_", "h_", ")_", ",_", "(_", "255_", ",_", "255_", ",_", "255_", ")_", ",_", "-_", "1_", ")_", "#", " ", "Draw", " ", "only", " ", "one", " ", "white", " ", "rect", "ange_", "\\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_", "delta", "\\u", "value_", ">_", "(_", "height_", "*_", "width_", "/_", "DELTA", "\\u", "LIMIT", "\\u", "DIVI", "SOR", "_", ")_", ":_", "#", " ", "If", " ", "delta", " ", "value", " ", "is", " ", "too", " ", "muc", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "break_", "#", " ", "The", "n", " ", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "There", " ", "is", " ", "just", " ", "a", " ", "PAN", ",", " ", "TI", "LT", ",", " ", "ROLL", " ", "situation", ".", " ", "Don", "'", "t", " ", "touch", " ", "anyt", "hing", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask", "\\u", "bigge", "st", "\\u", "conto", "ur\\u", "gray_", "=_", "cv2_", "._", "cvt", "Color_", "(_", "mask", "\\u", "bigge", "st", "\\u", "contour_", ",_", "cv2_", "._", "COLOR", "\\u", "BG", "R2", "GRAY_", ")_", "#", " ", "Convert", " ", "mask", "\\u", "bigge", "st", "\\u", "conto", "ur", " ", "to", " ", "grayscale", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thresh", "\\u", "bigge", "st", "\\u", "contour_", "=_", "cv2_", "._", "threshold_", "(_", "mask", "\\u", "bigge", "st", "\\u", "conto", "ur\\u", "gray_", ",_", "12_", ",_", "255_", ",_", "cv2_", "._", "THRESH", "\\u", "BINARY_", ")_", "[_", "1_", "]_", "#", " ", "Apply", " ", "Open", "CV", "'", "s", " ", "threshol", "d", " ", "function", " ", "to", " ", "get", " ", "binar", "y", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thresh", "\\u", "final", "\\u", "form_", "=_", "cv2_", "._", "bitwise", "\\u", "and_", "(_", "thresh_", ",_", "thresh_", ",_", "mask_", "=_", "thresh", "\\u", "bigge", "st", "\\u", "contour_", ")_", "#", " ", "Bit", "wis", "e", " ", "and", " ", "-", " ", "bigge", "st", " ", "conto", "ur", " ", "and", " ", "tres", "h", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thresh", "\\u", "final", "\\u", "form_", "=_", "cv2_", "._", "dilate", "_", "(_", "thresh", "\\u", "final", "\\u", "form_", ",_", "None_", ",_", "iterations_", "=_", "1_", ")_", "#", " ", "Dl", "ation", " ", "to", " ", "increase", " ", "white", " ", "region", " ", "for", " ", "surround", "ing", " ", "pixels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "Delta_", "=_", "cv2_", "._", "bitwise", "\\u", "and_", "(_", "frame", "\\u", "final", "\\u", "form_", ",_", "frame", "\\u", "final", "\\u", "form_", ",_", "mask_", "=_", "thresh", "\\u", "final", "\\u", "form_", ")_", "#", " ", "Bit", "wis", "e", " ", "and", " ", "-", " ", "to", " ", "get", " ", "delta", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "total", "\\u", "cra", "zy", "\\u", "lines_", ">=_", "CRA", "ZY", "\\u", "LINE", "\\u", "LIMIT_", ":_", "#", " ", "If", " ", "amo", "ut", " ", "of", " ", "total", " ", "cra", "zy", " ", "lines", " ", "is", " ", "great", "er", " ", "than", " ", "CRA", "ZY", "\\u", "LINE", "\\u", "LIMIT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "break_", "#", " ", "Break", " ", "the", " ", "loop", " ", "to", " ", "reconstruct", " ", "the", " ", "optic", "al", " ", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "frame", "\\u", "with", "\\u", "mask_", "=_", "cv2_", "._", "add_", "(_", "frame_", ",_", "mask_", ")_", "#", " ", "Add", " ", "mask", " ", "layer", " ", "over", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "imshow_", "(_", "'", "Origina", "l", " ", "Frame", "'_", ",_", "frame", "\\u", "with", "\\u", "mask_", ")_", "#", " ", "Show", " ", "Origina", "l", " ", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "imshow_", "(_", "'", "Mask", " ", "Del", "ta", "'_", ",_", "mask", "\\u", "delta_", ")_", "#", " ", "Show", " ", "Mask", " ", "Del", "ta", " ", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "imshow_", "(_", "'", "Mask", " ", "Big", "gest", " ", "Contour", "'_", ",_", "mask", "\\u", "bigge", "st", "\\u", "contour_", ")_", "#", " ", "Show", " ", "Mask", " ", "Del", "ta", " ", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "imshow_", "(_", "'", "Frame", " ", "Del", "ta", "'_", ",_", "frame", "Delta_", ")_", "#", " ", "Show", " ", "Frame", " ", "Delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "cv2_", "._", "wait", "Key_", "(_", "30_", ")_", "&_", "0xff_", "#", " ", "DEVELO", "PM", "ENT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "k_", "==_", "27_", ":_", "#", " ", "DEVELO", "PM", "ENT", " ", "PRESS", " ", "ESC", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "break_", "#", " ", "DEVELO", "PM", "ENT", " ", "BREAK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "gray_", "=_", "frame", "\\u", "gray_", "._", "copy_", "(_", ")_", "#", " ", "Update", " ", "the", " ", "previ", "ous", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "good", "\\u", "points", "2_", "._", "reshape_", "(_", "-_", "1_", ",_", "1_", ",_", "2_", ")_", "#", " ", "Update", " ", "previ", "ous", " ", "points_", "\\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_", "cv2_", "._", "destroy", "All", "Windows_", "(_", ")_", "#", " ", "Clos", "e", " ", "any", " ", "open", " ", "windows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cap_", "._", "release_", "(_", ")_", "#", " ", "Release", " ", "the", " ", "captur", "e", " ", "device_" ]
[ 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,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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 ]
Unused local variable
lisa-lab/DeepLearningTutorials/code/convolutional_mlp.py
[ { "content": "def evaluate_lenet5(learning_rate=0.1, n_epochs=200,\n dataset='mnist.pkl.gz',\n nkerns=[20, 50], batch_size=500):\n \"\"\" Demonstrates lenet on MNIST dataset\n\n :type learning_rate: float\n :param learning_rate: learning rate used (factor for the stochastic\n gradient)\n\n :type n_epochs: int\n :param n_epochs: maximal number of epochs to run the optimizer\n\n :type dataset: string\n :param dataset: path to the dataset used for training /testing (MNIST here)\n\n :type nkerns: list of ints\n :param nkerns: number of kernels on each layer\n \"\"\"\n\n rng = numpy.random.RandomState(23455)\n\n datasets = load_data(dataset)\n\n train_set_x, train_set_y = datasets[0]\n valid_set_x, valid_set_y = datasets[1]\n test_set_x, test_set_y = datasets[2]\n\n # compute number of minibatches for training, validation and testing\n n_train_batches = train_set_x.get_value(borrow=True).shape[0]\n n_valid_batches = valid_set_x.get_value(borrow=True).shape[0]\n n_test_batches = test_set_x.get_value(borrow=True).shape[0]\n n_train_batches //= batch_size\n n_valid_batches //= batch_size\n n_test_batches //= batch_size\n\n # allocate symbolic variables for the data\n index = T.lscalar() # index to a [mini]batch\n\n # start-snippet-1\n x = T.matrix('x') # the data is presented as rasterized images\n y = T.ivector('y') # the labels are presented as 1D vector of\n # [int] labels\n\n ######################\n # BUILD ACTUAL MODEL #\n ######################\n print('... building the model')\n\n # Reshape matrix of rasterized images of shape (batch_size, 28 * 28)\n # to a 4D tensor, compatible with our LeNetConvPoolLayer\n # (28, 28) is the size of MNIST images.\n layer0_input = x.reshape((batch_size, 1, 28, 28))\n\n # Construct the first convolutional pooling layer:\n # filtering reduces the image size to (28-5+1 , 28-5+1) = (24, 24)\n # maxpooling reduces this further to (24/2, 24/2) = (12, 12)\n # 4D output tensor is thus of shape (batch_size, nkerns[0], 12, 12)\n layer0 = LeNetConvPoolLayer(\n rng,\n input=layer0_input,\n image_shape=(batch_size, 1, 28, 28),\n filter_shape=(nkerns[0], 1, 5, 5),\n poolsize=(2, 2)\n )\n\n # Construct the second convolutional pooling layer\n # filtering reduces the image size to (12-5+1, 12-5+1) = (8, 8)\n # maxpooling reduces this further to (8/2, 8/2) = (4, 4)\n # 4D output tensor is thus of shape (batch_size, nkerns[1], 4, 4)\n layer1 = LeNetConvPoolLayer(\n rng,\n input=layer0.output,\n image_shape=(batch_size, nkerns[0], 12, 12),\n filter_shape=(nkerns[1], nkerns[0], 5, 5),\n poolsize=(2, 2)\n )\n\n # the HiddenLayer being fully-connected, it operates on 2D matrices of\n # shape (batch_size, num_pixels) (i.e matrix of rasterized images).\n # This will generate a matrix of shape (batch_size, nkerns[1] * 4 * 4),\n # or (500, 50 * 4 * 4) = (500, 800) with the default values.\n layer2_input = layer1.output.flatten(2)\n\n # construct a fully-connected sigmoidal layer\n layer2 = HiddenLayer(\n rng,\n input=layer2_input,\n n_in=nkerns[1] * 4 * 4,\n n_out=500,\n activation=T.tanh\n )\n\n # classify the values of the fully-connected sigmoidal layer\n layer3 = LogisticRegression(input=layer2.output, n_in=500, n_out=10)\n\n # the cost we minimize during training is the NLL of the model\n cost = layer3.negative_log_likelihood(y)\n\n # create a function to compute the mistakes that are made by the model\n test_model = theano.function(\n [index],\n layer3.errors(y),\n givens={\n x: test_set_x[index * batch_size: (index + 1) * batch_size],\n y: test_set_y[index * batch_size: (index + 1) * batch_size]\n }\n )\n\n validate_model = theano.function(\n [index],\n layer3.errors(y),\n givens={\n x: valid_set_x[index * batch_size: (index + 1) * batch_size],\n y: valid_set_y[index * batch_size: (index + 1) * batch_size]\n }\n )\n\n # create a list of all model parameters to be fit by gradient descent\n params = layer3.params + layer2.params + layer1.params + layer0.params\n\n # create a list of gradients for all model parameters\n grads = T.grad(cost, params)\n\n # train_model is a function that updates the model parameters by\n # SGD Since this model has many parameters, it would be tedious to\n # manually create an update rule for each model parameter. We thus\n # create the updates list by automatically looping over all\n # (params[i], grads[i]) pairs.\n updates = [\n (param_i, param_i - learning_rate * grad_i)\n for param_i, grad_i in zip(params, grads)\n ]\n\n train_model = theano.function(\n [index],\n cost,\n updates=updates,\n givens={\n x: train_set_x[index * batch_size: (index + 1) * batch_size],\n y: train_set_y[index * batch_size: (index + 1) * batch_size]\n }\n )\n # end-snippet-1\n\n ###############\n # TRAIN MODEL #\n ###############\n print('... training')\n # early-stopping parameters\n patience = 10000 # look as this many examples regardless\n patience_increase = 2 # wait this much longer when a new best is\n # found\n improvement_threshold = 0.995 # a relative improvement of this much is\n # considered significant\n validation_frequency = min(n_train_batches, patience // 2)\n # go through this many\n # minibatche before checking the network\n # on the validation set; in this case we\n # check every epoch\n\n best_validation_loss = numpy.inf\n best_iter = 0\n test_score = 0.\n start_time = timeit.default_timer()\n\n epoch = 0\n done_looping = False\n\n while (epoch < n_epochs) and (not done_looping):\n epoch = epoch + 1\n for minibatch_index in range(n_train_batches):\n\n iter = (epoch - 1) * n_train_batches + minibatch_index\n\n if iter % 100 == 0:\n print('training @ iter = ', iter)\n cost_ij = train_model(minibatch_index)\n\n if (iter + 1) % validation_frequency == 0:\n\n # compute zero-one loss on validation set\n validation_losses = [validate_model(i) for i\n in range(n_valid_batches)]\n this_validation_loss = numpy.mean(validation_losses)\n print('epoch %i, minibatch %i/%i, validation error %f %%' %\n (epoch, minibatch_index + 1, n_train_batches,\n this_validation_loss * 100.))\n\n # if we got the best validation score until now\n if this_validation_loss < best_validation_loss:\n\n #improve patience if loss improvement is good enough\n if this_validation_loss < best_validation_loss * \\\n improvement_threshold:\n patience = max(patience, iter * patience_increase)\n\n # save best validation score and iteration number\n best_validation_loss = this_validation_loss\n best_iter = iter\n\n # test it on the test set\n test_losses = [\n test_model(i)\n for i in range(n_test_batches)\n ]\n test_score = numpy.mean(test_losses)\n print((' epoch %i, minibatch %i/%i, test error of '\n 'best model %f %%') %\n (epoch, minibatch_index + 1, n_train_batches,\n test_score * 100.))\n\n if patience <= iter:\n done_looping = True\n break\n\n end_time = timeit.default_timer()\n print('Optimization complete.')\n print('Best validation score of %f %% obtained at iteration %i, '\n 'with test performance %f %%' %\n (best_validation_loss * 100., best_iter + 1, test_score * 100.))\n print(('The code for file ' +\n os.path.split(__file__)[1] +\n ' ran for %.2fm' % ((end_time - start_time) / 60.)), file=sys.stderr)", "metadata": "root.evaluate_lenet5", "header": "['module', '___EOS___']", "index": 119 } ]
[ { "span": "cost_ij ", "start_line": 295, "start_column": 12, "end_line": 295, "end_column": 19 } ]
[]
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_", "evaluate", "\\u", "len", "et", "5_", "(_", "learn", "ing", "\\u", "rate_", "=_", "0.1_", ",_", "n", "\\u", "epochs_", "=_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dataset_", "=_", "'", "mni", "st", ".", "pkl", ".", "gz", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nke", "rn", "s_", "=_", "[_", "20_", ",_", "50_", "]_", ",_", "batch", "\\u", "size_", "=_", "500_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Demo", "nstr", "ates", " ", "len", "et", " ", "on", " ", "MNIST", " ", "dataset", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "learn", "ing", "\\u", "rate", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "learn", "ing", "\\u", "rate", ":", " ", "learn", "ing", " ", "rate", " ", "used", " ", "(", "factor", " ", "for", " ", "the", " ", "stochastic", "\\", "10", ";", " ", " ", " ", " ", "gradi", "ent", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "n", "\\u", "epoch", "s", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "n", "\\u", "epoch", "s", ":", " ", "maximal", " ", "number", " ", "of", " ", "epoch", "s", " ", "to", " ", "run", " ", "the", " ", "optimize", "r", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "dataset", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "dataset", ":", " ", "path", " ", "to", " ", "the", " ", "dataset", " ", "used", " ", "for", " ", "train", "ing", " ", "/", "testi", "ng", " ", "(", "MNIST", " ", "here", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "nke", "rn", "s", ":", " ", "list", " ", "of", " ", "ints", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "nke", "rn", "s", ":", " ", "number", " ", "of", " ", "kernels", " ", "on", " ", "each", " ", "layer", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rng_", "=_", "numpy_", "._", "random_", "._", "Random", "State_", "(_", "2345", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "datasets_", "=_", "load", "\\u", "data_", "(_", "dataset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "set\\u", "x_", ",_", "train", "\\u", "set\\u", "y_", "=_", "datasets_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "\\u", "set\\u", "x_", ",_", "valid", "\\u", "set\\u", "y_", "=_", "datasets_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "set\\u", "x_", ",_", "test\\u", "set\\u", "y_", "=_", "datasets_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compute", " ", "number", " ", "of", " ", "minibatch", "es", " ", "for", " ", "train", "ing", ",", " ", "validation", " ", "and", " ", "testing_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "train", "\\u", "batches_", "=_", "train", "\\u", "set\\u", "x_", "._", "get", "\\u", "value_", "(_", "borrow", "_", "=_", "True_", ")_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "valid", "\\u", "batches_", "=_", "valid", "\\u", "set\\u", "x_", "._", "get", "\\u", "value_", "(_", "borrow", "_", "=_", "True_", ")_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "test\\u", "batches_", "=_", "test\\u", "set\\u", "x_", "._", "get", "\\u", "value_", "(_", "borrow", "_", "=_", "True_", ")_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "train", "\\u", "batches_", "//", "=_", "batch", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "valid", "\\u", "batches_", "//", "=_", "batch", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "test\\u", "batches_", "//", "=_", "batch", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "allocate", " ", "symbolic", " ", "variab", "les", " ", "for", " ", "the", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "T_", "._", "lsc", "ala", "r_", "(_", ")_", "#", " ", "index", " ", "to", " ", "a", " ", "[", "mini", "]", "batch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "start", "-", "snippet", "-1", "_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "T_", "._", "matrix_", "(_", "'", "x", "'_", ")_", "#", " ", "the", " ", "data", " ", "is", " ", "presente", "d", " ", "as", " ", "rasteri", "zed", " ", "images_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "T_", "._", "ive", "ctor_", "(_", "'", "y", "'_", ")_", "#", " ", "the", " ", "labels", " ", "are", " ", "presente", "d", " ", "as", " ", "1", "D", " ", "vector", " ", "of_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "[", "int", "]", " ", "labels_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "BUILD", " ", "ACT", "UAL", " ", "MODEL", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'...", " ", "buildi", "ng", " ", "the", " ", "model", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Res", "hap", "e", " ", "matrix", " ", "of", " ", "rasteri", "zed", " ", "images", " ", "of", " ", "shape", " ", "(", "batch", "\\u", "size", ",", " ", "2", "8", " ", "*", " ", "2", "8", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "a", " ", "4", "D", " ", "tensor", ",", " ", "compatible", " ", "with", " ", "our", " ", "Le", "Net", "Conv", "Poo", "l", "Layer_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "2", "8", ",", " ", "2", "8", ")", " ", "is", " ", "the", " ", "size", " ", "of", " ", "MNIST", " ", "images", "._", "\\u\\u\\uNL\\u\\u\\u_", "layer", "0", "\\u", "input_", "=_", "x_", "._", "reshape_", "(_", "(_", "batch", "\\u", "size_", ",_", "1_", ",_", "28_", ",_", "28_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Construct", " ", "the", " ", "first", " ", "convolution", "al", " ", "pooling", " ", "layer", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "filtering", " ", "reduce", "s", " ", "the", " ", "image", " ", "size", " ", "to", " ", "(", "2", "8", "-", "5", "+", "1", " ", ",", " ", "2", "8", "-", "5", "+", "1", ")", " ", "=", " ", "(", "24", ",", " ", "24", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "maxp", "ool", "ing", " ", "reduce", "s", " ", "this", " ", "fur", "ther", " ", "to", " ", "(", "24", "/", "2", ",", " ", "24", "/", "2", ")", " ", "=", " ", "(", "1", "2", ",", " ", "1", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "4", "D", " ", "output", " ", "tensor", " ", "is", " ", "thu", "s", " ", "of", " ", "shape", " ", "(", "batch", "\\u", "size", ",", " ", "nke", "rn", "s", "[", "0", "],", " ", "1", "2", ",", " ", "1", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "layer", "0_", "=_", "Le", "Net", "Conv", "Poo", "l", "Layer_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "rng_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input_", "=_", "layer", "0", "\\u", "input_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "shape_", "=_", "(_", "batch", "\\u", "size_", ",_", "1_", ",_", "28_", ",_", "28_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "\\u", "shape_", "=_", "(_", "nke", "rn", "s_", "[_", "0_", "]_", ",_", "1_", ",_", "5_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pools", "ize_", "=_", "(_", "2_", ",_", "2_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Construct", " ", "the", " ", "second", " ", "convolution", "al", " ", "pooling", " ", "layer_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "filtering", " ", "reduce", "s", " ", "the", " ", "image", " ", "size", " ", "to", " ", "(", "1", "2", "-", "5", "+", "1", ",", " ", "1", "2", "-", "5", "+", "1", ")", " ", "=", " ", "(", "8", ",", " ", "8", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "maxp", "ool", "ing", " ", "reduce", "s", " ", "this", " ", "fur", "ther", " ", "to", " ", "(", "8", "/", "2", ",", " ", "8", "/", "2", ")", " ", "=", " ", "(", "4", ",", " ", "4", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "4", "D", " ", "output", " ", "tensor", " ", "is", " ", "thu", "s", " ", "of", " ", "shape", " ", "(", "batch", "\\u", "size", ",", " ", "nke", "rn", "s", "[", "1", "],", " ", "4", ",", " ", "4", ")_", "\\u\\u\\uNL\\u\\u\\u_", "layer", "1_", "=_", "Le", "Net", "Conv", "Poo", "l", "Layer_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "rng_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input_", "=_", "layer", "0_", "._", "output_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "shape_", "=_", "(_", "batch", "\\u", "size_", ",_", "nke", "rn", "s_", "[_", "0_", "]_", ",_", "12_", ",_", "12_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "\\u", "shape_", "=_", "(_", "nke", "rn", "s_", "[_", "1_", "]_", ",_", "nke", "rn", "s_", "[_", "0_", "]_", ",_", "5_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pools", "ize_", "=_", "(_", "2_", ",_", "2_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "Hi", "dde", "n", "Layer", " ", "bei", "ng", " ", "full", "y", "-", "connect", "ed", ",", " ", "it", " ", "operate", "s", " ", "on", " ", "2", "D", " ", "matric", "es", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shape", " ", "(", "batch", "\\u", "size", ",", " ", "num", "\\u", "pixel", "s", ")", " ", "(", "i", ".", "e", " ", "matrix", " ", "of", " ", "rasteri", "zed", " ", "images", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "will", " ", "generat", "e", " ", "a", " ", "matrix", " ", "of", " ", "shape", " ", "(", "batch", "\\u", "size", ",", " ", "nke", "rn", "s", "[", "1", "]", " ", "*", " ", "4", " ", "*", " ", "4", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "(", "500", ",", " ", "50", " ", "*", " ", "4", " ", "*", " ", "4", ")", " ", "=", " ", "(", "500", ",", " ", "800", ")", " ", "with", " ", "the", " ", "default", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "layer", "2", "\\u", "input_", "=_", "layer", "1_", "._", "output_", "._", "flatten_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "construct", " ", "a", " ", "full", "y", "-", "connect", "ed", " ", "sigm", "oid", "al", " ", "layer_", "\\u\\u\\uNL\\u\\u\\u_", "layer", "2_", "=_", "Hi", "dde", "n", "Layer_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "rng_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input_", "=_", "layer", "2", "\\u", "input_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "in_", "=_", "nke", "rn", "s_", "[_", "1_", "]_", "*_", "4_", "*_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "out_", "=_", "500_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "activation_", "=_", "T_", "._", "tanh_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "classify", " ", "the", " ", "values", " ", "of", " ", "the", " ", "full", "y", "-", "connect", "ed", " ", "sigm", "oid", "al", " ", "layer_", "\\u\\u\\uNL\\u\\u\\u_", "layer", "3_", "=_", "Logi", "stic", "Regression_", "(_", "input_", "=_", "layer", "2_", "._", "output_", ",_", "n", "\\u", "in_", "=_", "500_", ",_", "n", "\\u", "out_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "cost", " ", "we", " ", "minimize", " ", "dur", "ing", " ", "train", "ing", " ", "is", " ", "the", " ", "NL", "L", " ", "of", " ", "the", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "cost_", "=_", "layer", "3_", "._", "negati", "ve", "\\u", "log", "\\u", "likelihood_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "function", " ", "to", " ", "compute", " ", "the", " ", "mist", "ake", "s", " ", "tha", "t", " ", "are", " ", "made", " ", "by", " ", "the", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "model_", "=_", "theano_", "._", "function_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "index_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "layer", "3_", "._", "errors_", "(_", "y_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "give", "ns_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ":_", "test\\u", "set\\u", "x_", "[_", "index_", "*_", "batch", "\\u", "size_", ":_", "(_", "index_", "+_", "1_", ")_", "*_", "batch", "\\u", "size_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "y_", ":_", "test\\u", "set\\u", "y_", "[_", "index_", "*_", "batch", "\\u", "size_", ":_", "(_", "index_", "+_", "1_", ")_", "*_", "batch", "\\u", "size_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "validat", "e\\u", "model_", "=_", "theano_", "._", "function_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "index_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "layer", "3_", "._", "errors_", "(_", "y_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "give", "ns_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ":_", "valid", "\\u", "set\\u", "x_", "[_", "index_", "*_", "batch", "\\u", "size_", ":_", "(_", "index_", "+_", "1_", ")_", "*_", "batch", "\\u", "size_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "y_", ":_", "valid", "\\u", "set\\u", "y_", "[_", "index_", "*_", "batch", "\\u", "size_", ":_", "(_", "index_", "+_", "1_", ")_", "*_", "batch", "\\u", "size_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "list", " ", "of", " ", "all", " ", "model", " ", "parameter", "s", " ", "to", " ", "be", " ", "fit", " ", "by", " ", "gradi", "ent", " ", "descent", "_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "layer", "3_", "._", "params_", "+_", "layer", "2_", "._", "params_", "+_", "layer", "1_", "._", "params_", "+_", "layer", "0_", "._", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "list", " ", "of", " ", "gradi", "ents", " ", "for", " ", "all", " ", "model", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "grads_", "=_", "T_", "._", "grad_", "(_", "cost_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "train", "\\u", "model", " ", "is", " ", "a", " ", "function", " ", "tha", "t", " ", "update", "s", " ", "the", " ", "model", " ", "parameter", "s", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SGD", " ", "Sin", "ce", " ", "this", " ", "model", " ", "has", " ", "many", " ", "parameter", "s", ",", " ", "it", " ", "wou", "ld", " ", "be", " ", "ted", "ious", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "manu", "ally", " ", "create", " ", "an", " ", "update", " ", "rule", " ", "for", " ", "each", " ", "model", " ", "parameter", ".", " ", "We", " ", "thu", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "the", " ", "update", "s", " ", "list", " ", "by", " ", "automati", "call", "y", " ", "looping", " ", "over", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "params", "[", "i", "],", " ", "grads", "[", "i", "])", " ", "pair", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "updates_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "param", "\\u", "i_", ",_", "param", "\\u", "i_", "-_", "learn", "ing", "\\u", "rate_", "*_", "grad", "\\u", "i_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "param", "\\u", "i_", ",_", "grad", "\\u", "i_", "in_", "zip_", "(_", "params_", ",_", "grads_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "model_", "=_", "theano_", "._", "function_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "index_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cost_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "updates_", "=_", "updates_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "give", "ns_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ":_", "train", "\\u", "set\\u", "x_", "[_", "index_", "*_", "batch", "\\u", "size_", ":_", "(_", "index_", "+_", "1_", ")_", "*_", "batch", "\\u", "size_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "y_", ":_", "train", "\\u", "set\\u", "y_", "[_", "index_", "*_", "batch", "\\u", "size_", ":_", "(_", "index_", "+_", "1_", ")_", "*_", "batch", "\\u", "size_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "end", "-", "snippet", "-1", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TRAIN", " ", "MODEL", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'...", " ", "train", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ear", "ly", "-", "stopping", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "patien", "ce_", "=_", "10000_", "#", " ", "look", " ", "as", " ", "this", " ", "many", " ", "example", "s", " ", "rega", "rd", "less_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patien", "ce", "\\u", "increase", "_", "=_", "2_", "#", " ", "wait", " ", "this", " ", "muc", "h", " ", "long", "er", " ", "whe", "n", " ", "a", " ", "new", " ", "best", " ", "is_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "found_", "\\u\\u\\uNL\\u\\u\\u_", "improvement", "\\u", "threshold_", "=_", "0.99", "5_", "#", " ", "a", " ", "relative", " ", "improvement", " ", "of", " ", "this", " ", "muc", "h", " ", "is_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "consider", "ed", " ", "significant", "_", "\\u\\u\\uNL\\u\\u\\u_", "validation", "\\u", "frequency_", "=_", "min_", "(_", "n", "\\u", "train", "\\u", "batches_", ",_", "patien", "ce_", "//_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "go", " ", "through", " ", "this", " ", "many_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "minibatch", "e", " ", "bef", "ore", " ", "checking", " ", "the", " ", "network_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "the", " ", "validation", " ", "set", ";", " ", "in", " ", "this", " ", "case", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "every", " ", "epoch_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "best", "\\u", "validation", "\\u", "loss_", "=_", "numpy_", "._", "inf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "iter_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "score_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "time_", "=_", "timeit_", "._", "default", "\\u", "timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "epoch_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "don", "e\\u", "looping", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "epoch_", "<_", "n", "\\u", "epochs_", ")_", "and_", "(_", "not_", "don", "e\\u", "looping", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "epoch_", "=_", "epoch_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "minibatch", "\\u", "index_", "in_", "range_", "(_", "n", "\\u", "train", "\\u", "batches_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iter_", "=_", "(_", "epoch_", "-_", "1_", ")_", "*_", "n", "\\u", "train", "\\u", "batches_", "+_", "minibatch", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "iter_", "%_", "100_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "train", "ing", " ", "@", " ", "iter", " ", "=", " ", "'_", ",_", "iter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cost", "\\u", "ij_", "=_", "train", "\\u", "model_", "(_", "minibatch", "\\u", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "iter_", "+_", "1_", ")_", "%_", "validation", "\\u", "frequency_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compute", " ", "zero", "-", "one", " ", "loss", " ", "on", " ", "validation", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validation", "\\u", "losses_", "=_", "[_", "validat", "e\\u", "model_", "(_", "i_", ")_", "for_", "i_", "\\u\\u\\uNL\\u\\u\\u_", "in_", "range_", "(_", "n", "\\u", "valid", "\\u", "batches_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "\\u", "validation", "\\u", "loss_", "=_", "numpy_", "._", "mean_", "(_", "validation", "\\u", "losses_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "epoch", " ", "%", "i", ",", " ", "minibatch", " ", "%", "i", "/", "%", "i", ",", " ", "validation", " ", "error", " ", "%", "f", " ", "%%'", "_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "epoch_", ",_", "minibatch", "\\u", "index_", "+_", "1_", ",_", "n", "\\u", "train", "\\u", "batches_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "validation", "\\u", "loss_", "*_", "100._", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "got", " ", "the", " ", "best", " ", "validation", " ", "score", " ", "unti", "l", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "this", "\\u", "validation", "\\u", "loss_", "<_", "best", "\\u", "validation", "\\u", "loss_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "improve", " ", "patien", "ce", " ", "if", " ", "loss", " ", "improvement", " ", "is", " ", "good", " ", "eno", "ugh", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "this", "\\u", "validation", "\\u", "loss_", "<_", "best", "\\u", "validation", "\\u", "loss_", "*_", "improvement", "\\u", "threshold_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "patien", "ce_", "=_", "max_", "(_", "patien", "ce_", ",_", "iter_", "*_", "patien", "ce", "\\u", "increase", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "best", " ", "validation", " ", "score", " ", "and", " ", "iterati", "on", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "best", "\\u", "validation", "\\u", "loss_", "=_", "this", "\\u", "validation", "\\u", "loss_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "iter_", "=_", "iter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "it", " ", "on", " ", "the", " ", "test", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "losses_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "model_", "(_", "i_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "n", "\\u", "test\\u", "batches_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "score_", "=_", "numpy_", "._", "mean_", "(_", "test\\u", "losses_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "(_", "'", " ", "epoch", " ", "%", "i", ",", " ", "minibatch", " ", "%", "i", "/", "%", "i", ",", " ", "test", " ", "error", " ", "of", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "best", " ", "model", " ", "%", "f", " ", "%%'", "_", ")_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "epoch_", ",_", "minibatch", "\\u", "index_", "+_", "1_", ",_", "n", "\\u", "train", "\\u", "batches_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "score_", "*_", "100._", ")_", ")_", "\\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_", "patien", "ce_", "<=_", "iter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "don", "e\\u", "looping", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "end", "\\u", "time_", "=_", "timeit_", "._", "default", "\\u", "timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Optim", "izatio", "n", " ", "complete", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Bes", "t", " ", "validation", " ", "score", " ", "of", " ", "%", "f", " ", "%%", " ", "obtain", "ed", " ", "at", " ", "iterati", "on", " ", "%", "i", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "with", " ", "test", " ", "perform", "anc", "e", " ", "%", "f", " ", "%%'", "_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "best", "\\u", "validation", "\\u", "loss_", "*_", "100._", ",_", "best", "\\u", "iter_", "+_", "1_", ",_", "test\\u", "score_", "*_", "100._", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "(_", "'", "The", " ", "code", " ", "for", " ", "file", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "split_", "(_", "\\u\\u", "file\\u\\u_", ")_", "[_", "1_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "ran", " ", "for", " ", "%", ".2", "fm", "'_", "%_", "(_", "(_", "end", "\\u", "time_", "-_", "start", "\\u", "time_", ")_", "/_", "60._", ")_", ")_", ",_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\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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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 ]
Unused import
OpenMDAO/OpenMDAO-Framework/examples/openmdao.examples.expected_improvement/openmdao/examples/expected_improvement/auto_single_ei.py
[ { "content": "import os.path\n\nfrom openmdao.main.problem_formulation import ArchitectureAssembly\n\nfrom openmdao.lib.architectures.api import EGO\n\nfrom openmdao.lib.optproblems.branin import BraninComponent\n\n\n\n\n\n\nif __name__ == \"__main__\":\n import sys\n from openmdao.lib.casehandlers.api import case_db_to_dict\n\n seed = None\n backend = None\n figname = None\n for arg in sys.argv[1:]:\n if arg.startswith('--seed='):\n import random\n seed = int(arg.split('=')[1])\n random.seed(seed)\n if arg.startswith('--backend='):\n backend = arg.split('=')[1]\n if arg.startswith('--figname='):\n figname = arg.split('=')[1]\n import matplotlib\n if backend is not None:\n matplotlib.use(backend)\n elif sys.platform == 'win32':\n matplotlib.use('WxAgg')\n from matplotlib import pyplot as plt, cm\n from matplotlib.pylab import get_cmap\n from numpy import meshgrid,array, pi,arange,cos\n\n analysis = Analysis()\n analysis.architecture = EGO()\n analysis.architecture.initial_DOE_size = 20\n analysis.architecture.sample_iterations = 20\n analysis.architecture.EI_PI = \"PI\"\n analysis.architecture.min_ei_pi = .01\n analysis.run()\n\n\n #A whole bunch of stuff to make some cool plots!\n points = [(-pi,12.275,.39789),(pi,2.275,.39789),(9.42478,2.745,.39789)]\n for x,y,z in points:\n print \"x: \", x, \"; y: \", y\n analysis.branin.x = x\n analysis.branin.y = y\n analysis.branin.execute()\n print \"f_xy: \",analysis.branin.f_xy, \" % error: \", \\\n (analysis.branin.f_xy.mu - z)/z*100\n\n #Generate the Contour plot to show the function\n\n X_range = arange(-5,10.2,.25)\n Y_range = arange(0,15.2,.25)\n\n X,Y = meshgrid(X_range,Y_range)\n Z = branin(X,Y)\n\n plt.contour(X,Y,Z,arange(1,200,2),zorder=1)\n\n cb = plt.colorbar(shrink=.45)\n #plot the initial training data\n data_train = case_db_to_dict(os.path.join(analysis.architecture._tdir,'trainer.db'),\n ['branin.y',\n 'branin.x',])\n\n plt.scatter(data_train['branin.x'],\n data_train['branin.y'],s=30,c='#572E07',zorder=10)\n\n data_EI = {}\n data_EI['branin.x'] = data_train['branin.x'][analysis.architecture.initial_DOE_size:]\n data_EI['branin.y'] = data_train['branin.y'][analysis.architecture.initial_DOE_size:]\n\n\n count = len(data_EI['branin.x'])\n print \"%d adaptively sampled points\"%count\n colors = arange(0,count)/float(count)\n\n color_map = get_cmap('spring')\n\n\n plt.scatter(data_EI['branin.x'],data_EI['branin.y'],\n s=30,\n c=colors,\n zorder=11,\n cmap=color_map)\n\n plt.axis([-5,10,0,15])\n plt.xlabel(\"x\")\n plt.ylabel(\"y\")\n plt.title(\"Branin Function Contours and EI Sample Points\")\n plt.text(10.9,11,\"Branin\\nFunction\\nValue\")\n\n if figname is not None:\n matplotlib.pylab.savefig(figname)\n\n plt.figure()\n Z2 = []\n\n for x_row,y_row in zip(X,Y):\n row = []\n for x,y in zip(x_row,y_row):\n analysis.branin.x = x\n analysis.branin.y = y\n analysis.branin.execute()\n row.append(analysis.branin.f_xy.mu)\n Z2.append(row)\n Z2 = array(Z2)\n plt.contour(X,Y,Z2,arange(1,200,2),zorder=1)\n cb = plt.colorbar(shrink=.45)\n plt.axis([-5,10,0,15])\n plt.xlabel(\"x\")\n plt.ylabel(\"y\")\n plt.title(\"Branin Meta Model Contours\")\n plt.text(10.9,11,\"Meta Model\\nFunction\\nValue\")\n\n plt.show()\n\n analysis.architecture.cleanup()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Analysis(ArchitectureAssembly):", "metadata": "root.Analysis", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def __init__(self):\n super(Analysis, self).__init__()\n\n self.add('branin', BraninComponent())\n\n #Problem Formulation\n\n #Local Des Vars\n self.add_parameter('branin.x',low=-5.,high=10.)\n self.add_parameter('branin.y',low=0.,high=15.)\n\n #No Global Des Vars or Coupling Vars\n\n #Objective (single only)\n self.add_objective('branin.f_xy')\n #No constraints for this problem", "metadata": "root.Analysis.__init__", "header": "['class', 'Analysis', '(', 'ArchitectureAssembly', ')', ':', '___EOS___']", "index": 10 }, { "content": " def branin(x,y):\n return (y-(5.1/(4.*pi**2.))*x**2.+5.*x/pi-6.)**2.+\\\n 10.*(1.-1./(8.*pi))*cos(x)+10.", "metadata": "root.branin", "header": "['module', '___EOS___']", "index": 75 } ]
[ { "span": "from matplotlib import pyplot as plt, cm", "start_line": 51, "start_column": 4, "end_line": 51, "end_column": 44 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openm", "dao_", "._", "main_", "._", "problem", "\\u", "formula", "tion_", "import_", "Architecture", "Asse", "mbly", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openm", "dao_", "._", "lib_", "._", "architecture", "s_", "._", "api_", "import_", "EG", "O_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openm", "dao_", "._", "lib_", "._", "opt", "problems_", "._", "bran", "in_", "import_", "Bra", "nin", "Component_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openm", "dao_", "._", "lib_", "._", "case", "handlers_", "._", "api_", "import_", "case", "\\u", "db", "\\u", "to", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "seed_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fign", "ame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg_", "._", "startswith_", "(_", "'--", "seed", "='_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seed_", "=_", "int_", "(_", "arg_", "._", "split_", "(_", "'='_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random_", "._", "seed_", "(_", "seed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "arg_", "._", "startswith_", "(_", "'--", "back", "end", "='_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "backend_", "=_", "arg_", "._", "split_", "(_", "'='_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "arg_", "._", "startswith_", "(_", "'--", "fign", "ame", "='_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fign", "ame_", "=_", "arg_", "._", "split_", "(_", "'='_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "matplotlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "backend_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "matplotlib_", "._", "use_", "(_", "backend_", ")_", "\\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 ", " _", "matplotlib_", "._", "use_", "(_", "'", "Wx", "Agg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "matplotlib_", "import_", "pyplot_", "as_", "plt_", ",_", "cm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "matplotlib_", "._", "pylab_", "import_", "get", "\\u", "cmap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "import_", "meshgrid_", ",_", "array_", ",_", "pi_", ",_", "arange_", ",_", "cos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "analysis_", "=_", "Analysis_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "analysis_", "._", "architecture_", "=_", "EG", "O_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "analysis_", "._", "architecture_", "._", "initial", "\\u", "DO", "E", "\\u", "size_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "analysis_", "._", "architecture_", "._", "sample", "\\u", "iterations_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "analysis_", "._", "architecture_", "._", "EI", "\\u", "PI_", "=_", "\"", "PI", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "analysis_", "._", "architecture_", "._", "min", "\\u", "ei", "\\u", "pi_", "=_", ".01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "analysis_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "A", " ", "whole", " ", "bunch", " ", "of", " ", "stu", "ff", " ", "to", " ", "make", " ", "some", " ", "cool", " ", "plots", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "[_", "(_", "-_", "pi_", ",_", "12.", "275_", ",_", ".3", "978", "9_", ")_", ",_", "(_", "pi_", ",_", "2.2", "75_", ",_", ".3", "978", "9_", ")_", ",_", "(_", "9.4", "247", "8_", ",_", "2.7", "45_", ",_", ".3", "978", "9_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", ",_", "y_", ",_", "z_", "in_", "points_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "x", ":", " ", "\"_", ",_", "x_", ",_", "\";", " ", "y", ":", " ", "\"_", ",_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "analysis_", "._", "bran", "in_", "._", "x_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "analysis_", "._", "bran", "in_", "._", "y_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "analysis_", "._", "bran", "in_", "._", "execute_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "f", "\\u", "xy", ":", " ", "\"_", ",_", "analysis_", "._", "bran", "in_", "._", "f", "\\u", "xy_", ",_", "\"", " ", "%", " ", "error", ":", " ", "\"_", ",_", "(_", "analysis_", "._", "bran", "in_", "._", "f", "\\u", "xy_", "._", "mu_", "-_", "z_", ")_", "/_", "z_", "*_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Generate", " ", "the", " ", "Contour", " ", "plot", " ", "to", " ", "show", " ", "the", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "X", "\\u", "range_", "=_", "arange_", "(_", "-_", "5_", ",_", "10.2", "_", ",_", ".25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y", "\\u", "range_", "=_", "arange_", "(_", "0_", ",_", "15.", "2_", ",_", ".25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", ",_", "Y_", "=_", "meshgrid_", "(_", "X", "\\u", "range_", ",_", "Y", "\\u", "range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Z_", "=_", "bran", "in_", "(_", "X_", ",_", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "contour_", "(_", "X_", ",_", "Y_", ",_", "Z_", ",_", "arange_", "(_", "1_", ",_", "200_", ",_", "2_", ")_", ",_", "zorder_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cb_", "=_", "plt_", "._", "colorbar_", "(_", "shrink", "_", "=_", ".4", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "plot", " ", "the", " ", "initial", " ", "train", "ing", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "train_", "=_", "case", "\\u", "db", "\\u", "to", "\\u", "dict_", "(_", "os_", "._", "path_", "._", "join_", "(_", "analysis_", "._", "architecture_", "._", "\\u", "tdir", "_", ",_", "'", "trainer", ".", "db", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "bran", "in", ".", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bran", "in", ".", "x", "'_", ",_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "scatter_", "(_", "data\\u", "train_", "[_", "'", "bran", "in", ".", "x", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "train_", "[_", "'", "bran", "in", ".", "y", "'_", "]_", ",_", "s_", "=_", "30_", ",_", "c_", "=_", "'#", "572", "E0", "7", "'_", ",_", "zorder_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "EI", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "EI", "_", "[_", "'", "bran", "in", ".", "x", "'_", "]_", "=_", "data\\u", "train_", "[_", "'", "bran", "in", ".", "x", "'_", "]_", "[_", "analysis_", "._", "architecture_", "._", "initial", "\\u", "DO", "E", "\\u", "size_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "EI", "_", "[_", "'", "bran", "in", ".", "y", "'_", "]_", "=_", "data\\u", "train_", "[_", "'", "bran", "in", ".", "y", "'_", "]_", "[_", "analysis_", "._", "architecture_", "._", "initial", "\\u", "DO", "E", "\\u", "size_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "len_", "(_", "data\\u", "EI", "_", "[_", "'", "bran", "in", ".", "x", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"%", "d", " ", "adapti", "vel", "y", " ", "sample", "d", " ", "points", "\"_", "%_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "arange_", "(_", "0_", ",_", "count_", ")_", "/_", "float_", "(_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "color", "\\u", "map_", "=_", "get", "\\u", "cmap_", "(_", "'", "spring", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "scatter_", "(_", "data\\u", "EI", "_", "[_", "'", "bran", "in", ".", "x", "'_", "]_", ",_", "data\\u", "EI", "_", "[_", "'", "bran", "in", ".", "y", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "30_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "colors_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zorder_", "=_", "11_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmap_", "=_", "color", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "axis_", "(_", "[_", "-_", "5_", ",_", "10_", ",_", "0_", ",_", "15_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xlabel_", "(_", "\"", "x", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylabel_", "(_", "\"", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "title_", "(_", "\"", "Bra", "nin", " ", "Function", " ", "Contours", " ", "and", " ", "EI", " ", "Sampl", "e", " ", "Point", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "text_", "(_", "10.", "9_", ",_", "11_", ",_", "\"", "Bra", "nin", "\\\\", "n", "Function", "\\\\", "n", "Value", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "fign", "ame_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "matplotlib_", "._", "pylab_", "._", "savefig_", "(_", "fign", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Z2", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x", "\\u", "row_", ",_", "y", "\\u", "row_", "in_", "zip_", "(_", "X_", ",_", "Y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", ",_", "y_", "in_", "zip_", "(_", "x", "\\u", "row_", ",_", "y", "\\u", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "analysis_", "._", "bran", "in_", "._", "x_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "analysis_", "._", "bran", "in_", "._", "y_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "analysis_", "._", "bran", "in_", "._", "execute_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "._", "append_", "(_", "analysis_", "._", "bran", "in_", "._", "f", "\\u", "xy_", "._", "mu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Z2", "_", "._", "append_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Z2", "_", "=_", "array_", "(_", "Z2", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "contour_", "(_", "X_", ",_", "Y_", ",_", "Z2", "_", ",_", "arange_", "(_", "1_", ",_", "200_", ",_", "2_", ")_", ",_", "zorder_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cb_", "=_", "plt_", "._", "colorbar_", "(_", "shrink", "_", "=_", ".4", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "axis_", "(_", "[_", "-_", "5_", ",_", "10_", ",_", "0_", ",_", "15_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xlabel_", "(_", "\"", "x", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylabel_", "(_", "\"", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "title_", "(_", "\"", "Bra", "nin", " ", "Meta", " ", "Model", " ", "Contours", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "text_", "(_", "10.", "9_", ",_", "11_", ",_", "\"", "Meta", " ", "Model", "\\\\", "n", "Function", "\\\\", "n", "Value", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "analysis_", "._", "architecture_", "._", "cleanup_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Analysis_", "(_", "Architecture", "Asse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Analysis_", "(_", "Architecture", "Asse", "mbly", "_", ")_", ":_", "\\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 ", " _", "super_", "(_", "Analysis_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add_", "(_", "'", "bran", "in", "'_", ",_", "Bra", "nin", "Component_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Prob", "lem", " ", "Form", "ulation", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Local", " ", "Des", " ", "Vars_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "\\u", "parameter_", "(_", "'", "bran", "in", ".", "x", "'_", ",_", "low_", "=_", "-_", "5._", ",_", "high_", "=_", "10._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "parameter_", "(_", "'", "bran", "in", ".", "y", "'_", ",_", "low_", "=_", "0._", ",_", "high_", "=_", "15.", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "No", " ", "Global", " ", "Des", " ", "Var", "s", " ", "or", " ", "Coupling", " ", "Vars_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Objecti", "ve", " ", "(", "single", " ", "only", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "\\u", "objective_", "(_", "'", "bran", "in", ".", "f", "\\u", "xy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "No", " ", "constraint", "s", " ", "for", " ", "this", " ", "problem_", "\\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_", "bran", "in_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "y_", "-_", "(_", "5.1", "_", "/_", "(_", "4._", "*_", "pi_", "**_", "2._", ")_", ")_", "*_", "x_", "**_", "2._", "+_", "5._", "*_", "x_", "/_", "pi_", "-_", "6._", ")_", "**_", "2._", "+_", "10._", "*_", "(_", "1._", "-_", "1._", "/_", "(_", "8._", "*_", "pi_", ")_", ")_", "*_", "cos_", "(_", "x_", ")_", "+_", "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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 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 ]
Unused import
OpenMDAO/OpenMDAO-Framework/openmdao.test/src/openmdao/test/plugins/bar/bar.py
[ { "content": "\nimport foo\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Comp1Plugin(object):", "metadata": "root.Comp1Plugin", "header": "['module', '___EOS___']", "index": 3 }, { "content": " def __init__(self):\n self.version = '1.0'", "metadata": "root.Comp1Plugin.__init__", "header": "['class', 'Comp1Plugin', '(', 'object', ')', ':', '___EOS___']", "index": 4 }, { "content": "class Comp2Plugin(object):", "metadata": "root.Comp2Plugin", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def __init__(self):\n self.version = '1.0'", "metadata": "root.Comp2Plugin.__init__", "header": "['class', 'Comp2Plugin', '(', 'object', ')', ':', '___EOS___']", "index": 9 } ]
[ { "span": "import foo", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "foo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Comp", "1", "Plugin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comp", "1", "Plugin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "version_", "=_", "'", "1.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_", "Comp", "2", "Plugin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comp", "2", "Plugin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "version_", "=_", "'", "1.0", "'_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Redundant assignment
ecdavis/pants/pants/web/application.py
[ { "content": " def __init__(self, options, default):\n # Handle the options.\n self.default = default\n args, kwargs = [], {}\n if options:\n for key, val in OPTIONS_PARSER.findall(options):\n if val.lower() == 'none':\n val = None\n elif val.lower() == 'true':\n val = True\n elif val.lower() == 'false':\n val = False\n else:\n try:\n val = int(val)\n except ValueError:\n try:\n val = float(val)\n except ValueError:\n pass\n\n if isinstance(val, basestring):\n val = val\n if (val[0] == '\"' and val[-1] == '\"') or \\\n (val[0] == \"'\" and val[-1] == \"'\"):\n val = val[1:-1]\n\n if key:\n kwargs[key] = val\n else:\n args.append(val)\n\n # Now, configure it with those settings.\n #noinspection PyArgumentList\n self.configure(*args, **kwargs)\n\n # Count our capture groups.\n self._regex = re.compile(\"^%s$\" % self.regex)\n self.capture_groups = self._regex.groups", "metadata": "root.Converter.__init__", "header": "['class', 'Converter', '(', 'object', ')', ':', '___EOS___']", "index": 516 } ]
[ { "span": "val = val", "start_line": 538, "start_column": 20, "end_line": 538, "end_column": 29 } ]
[]
1
true
[ "[CLS]_", "Redu", "ndan", "t_", "assignment_", "[SEP]_", "class_", "Converter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "options_", ",_", "default_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Handle", " ", "the", " ", "options", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "default_", "=_", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", ",_", "kwargs_", "=_", "[_", "]_", ",_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "val_", "in_", "OPTION", "S", "\\u", "PARSER_", "._", "findall_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "val_", "._", "lower_", "(_", ")_", "==_", "'", "none", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "val_", "._", "lower_", "(_", ")_", "==_", "'", "true", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "val_", "._", "lower_", "(_", ")_", "==_", "'", "fal", "se", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "=_", "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 ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "=_", "int_", "(_", "val_", ")_", "\\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 ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "=_", "float_", "(_", "val_", ")_", "\\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 ", " ", " _", "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_", "if_", "isinstance_", "(_", "val_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "val_", "[_", "0_", "]_", "==_", "'\"'_", "and_", "val_", "[_", "-_", "1_", "]_", "==_", "'\"'_", ")_", "or_", "(_", "val_", "[_", "0_", "]_", "==_", "\"'\"_", "and_", "val_", "[_", "-_", "1_", "]_", "==_", "\"'\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "=_", "val_", "[_", "1_", ":_", "-_", "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_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "kwargs_", "[_", "key_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "args_", "._", "append_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", ",", " ", "configur", "e", " ", "it", " ", "with", " ", "tho", "se", " ", "settings", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "noin", "spect", "ion", " ", "Py", "Arg", "ument", "List_", "\\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_", "._", "configure_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Count", " ", "our", " ", "captur", "e", " ", "group", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "regex_", "=_", "re_", "._", "compile_", "(_", "\"", "^", "%", "s", "$\"_", "%_", "self_", "._", "regex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "captur", "e\\u", "groups_", "=_", "self_", "._", "\\u", "regex_", "._", "groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Yubico/python-pyhsm/test/test_util.py
[ { "content": "# Copyright (c) 2011 Yubico AB\n# See the file COPYING for licence statement.\n\nimport sys\nimport unittest\nimport pyhsm\n\nimport test_common\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestUtil(test_common.YHSM_TestCase):\n\n\n\n", "metadata": "root.TestUtil", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def setUp(self):\n test_common.YHSM_TestCase.setUp(self)", "metadata": "root.TestUtil.setUp", "header": "['class', 'TestUtil', '(', 'test_common', '.', 'YHSM_TestCase', ')', ':', '___EOS___']", "index": 11 }, { "content": " def test_hexdump(self):\n \"\"\" Test hexdump function. \"\"\"\n data1 = ''.join([chr(x) for x in xrange(8)])\n self.assertEquals('0000 00 01 02 03 04 05 06 07\\n', pyhsm.util.hexdump(data1))\n data2 = ''.join([chr(x) for x in xrange(64)])\n self.assertEquals(248, len(pyhsm.util.hexdump(data2)))\n self.assertEquals('', pyhsm.util.hexdump(''))", "metadata": "root.TestUtil.test_hexdump", "header": "['class', 'TestUtil', '(', 'test_common', '.', 'YHSM_TestCase', ')', ':', '___EOS___']", "index": 14 }, { "content": " def test_response_validation(self):\n \"\"\" Test response validation functions. \"\"\"\n self.assertRaises(pyhsm.exception.YHSM_Error, pyhsm.util.validate_cmd_response_str, \\\n 'test', 'abc', 'def', hex_encode=True)\n\n self.assertRaises(pyhsm.exception.YHSM_Error, pyhsm.util.validate_cmd_response_str, \\\n 'test', 'abc', 'def', hex_encode=False)", "metadata": "root.TestUtil.test_response_validation", "header": "['class', 'TestUtil', '(', 'test_common', '.', 'YHSM_TestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def test_input_validate_str(self):\n \"\"\" Test string input validation. \"\"\"\n self.assertRaises(pyhsm.exception.YHSM_WrongInputType, pyhsm.util.input_validate_str, \\\n 0, 'foo', exact_len = 5)\n\n self.assertRaises(pyhsm.exception.YHSM_InputTooLong, pyhsm.util.input_validate_str, \\\n '1234', 'foo', max_len = 3)\n self.assertEquals('1234', pyhsm.util.input_validate_str('1234', 'foo', max_len = 4))\n self.assertEquals('1234', pyhsm.util.input_validate_str('1234', 'foo', max_len = 14))\n\n self.assertRaises(pyhsm.exception.YHSM_WrongInputSize, pyhsm.util.input_validate_str, \\\n '1234', 'foo', exact_len = 5)\n self.assertEquals('1234', pyhsm.util.input_validate_str('1234', 'foo', exact_len = 4))", "metadata": "root.TestUtil.test_input_validate_str", "header": "['class', 'TestUtil', '(', 'test_common', '.', 'YHSM_TestCase', ')', ':', '___EOS___']", "index": 30 } ]
[ { "span": "import sys", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 10 }, { "span": "import unittest", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2011", " ", "Yu", "bic", "o", " ", "AB_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "file", " ", "COPY", "ING", " ", "for", " ", "licence", " ", "statem", "ent", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyh", "sm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "test\\u", "common_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Util_", "(_", "test\\u", "common_", "._", "YH", "SM", "\\u", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Util_", "(_", "test\\u", "common_", "._", "YH", "SM", "\\u", "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 ", " _", "test\\u", "common_", "._", "YH", "SM", "\\u", "Test", "Case_", "._", "set", "Up_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Util_", "(_", "test\\u", "common_", "._", "YH", "SM", "\\u", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hexd", "ump_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", " ", "hexd", "ump", " ", "function", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data1_", "=_", "''_", "._", "join_", "(_", "[_", "chr_", "(_", "x_", ")_", "for_", "x_", "in_", "xrange_", "(_", "8_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "'", "0000", " ", " ", " ", "00", " ", "01", " ", "02", " ", "03", " ", "04", " ", "05", " ", "0", "6", " ", "0", "7", "\\\\", "n", "'_", ",_", "pyh", "sm_", "._", "util_", "._", "hexd", "ump_", "(_", "data1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data2_", "=_", "''_", "._", "join_", "(_", "[_", "chr_", "(_", "x_", ")_", "for_", "x_", "in_", "xrange_", "(_", "64_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "248_", ",_", "len_", "(_", "pyh", "sm_", "._", "util_", "._", "hexd", "ump_", "(_", "data2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "''_", ",_", "pyh", "sm_", "._", "util_", "._", "hexd", "ump_", "(_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Util_", "(_", "test\\u", "common_", "._", "YH", "SM", "\\u", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "response", "\\u", "validation_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", " ", "response", " ", "validation", " ", "function", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "pyh", "sm_", "._", "exception_", "._", "YH", "SM", "\\u", "Error_", ",_", "pyh", "sm_", "._", "util_", "._", "validat", "e\\u", "cmd", "\\u", "response", "\\u", "str_", ",_", "'", "test", "'_", ",_", "'", "abc", "'_", ",_", "'", "def", "'_", ",_", "hex", "\\u", "encode_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "pyh", "sm_", "._", "exception_", "._", "YH", "SM", "\\u", "Error_", ",_", "pyh", "sm_", "._", "util_", "._", "validat", "e\\u", "cmd", "\\u", "response", "\\u", "str_", ",_", "'", "test", "'_", ",_", "'", "abc", "'_", ",_", "'", "def", "'_", ",_", "hex", "\\u", "encode_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Util_", "(_", "test\\u", "common_", "._", "YH", "SM", "\\u", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "input", "\\u", "validat", "e\\u", "str_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", " ", "string", " ", "input", " ", "validation", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "pyh", "sm_", "._", "exception_", "._", "YH", "SM", "\\u", "Wro", "ng", "Inp", "ut", "Type_", ",_", "pyh", "sm_", "._", "util_", "._", "input", "\\u", "validat", "e\\u", "str_", ",_", "0_", ",_", "'", "foo", "'_", ",_", "exact", "\\u", "len_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "pyh", "sm_", "._", "exception_", "._", "YH", "SM", "\\u", "Inp", "ut", "Too", "Long_", ",_", "pyh", "sm_", "._", "util_", "._", "input", "\\u", "validat", "e\\u", "str_", ",_", "'", "1234", "'_", ",_", "'", "foo", "'_", ",_", "max", "\\u", "len_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "'", "1234", "'_", ",_", "pyh", "sm_", "._", "util_", "._", "input", "\\u", "validat", "e\\u", "str_", "(_", "'", "1234", "'_", ",_", "'", "foo", "'_", ",_", "max", "\\u", "len_", "=_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "'", "1234", "'_", ",_", "pyh", "sm_", "._", "util_", "._", "input", "\\u", "validat", "e\\u", "str_", "(_", "'", "1234", "'_", ",_", "'", "foo", "'_", ",_", "max", "\\u", "len_", "=_", "14_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "pyh", "sm_", "._", "exception_", "._", "YH", "SM", "\\u", "Wro", "ng", "Inp", "ut", "Size_", ",_", "pyh", "sm_", "._", "util_", "._", "input", "\\u", "validat", "e\\u", "str_", ",_", "'", "1234", "'_", ",_", "'", "foo", "'_", ",_", "exact", "\\u", "len_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "'", "1234", "'_", ",_", "pyh", "sm_", "._", "util_", "._", "input", "\\u", "validat", "e\\u", "str_", "(_", "'", "1234", "'_", ",_", "'", "foo", "'_", ",_", "exact", "\\u", "len_", "=_", "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, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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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 ]
Missing call to `__init__` during object initialization
marshall/logcat-color/logcatcolor/column.py
[ { "content": " def __init__(self, layout):\n self.width = layout.config.get_column_width(self)", "metadata": "root.Column.__init__", "header": "['class', 'Column', '(', 'object', ')', ':', '___EOS___']", "index": 15 }, { "content": "class MessageColumn(Column):\n NAME = \"message\"\n DEFAULT_WIDTH = 0\n", "metadata": "root.MessageColumn", "header": "['module', '___EOS___']", "index": 122 }, { "content": " def __init__(self, layout):\n self.width = None\n self.left = layout.total_column_width\n if layout.config.get_wrap() and (not layout.profile or layout.profile.wrap):\n self.width = layout.width - self.left", "metadata": "root.MessageColumn.__init__", "header": "['class', 'MessageColumn', '(', 'Column', ')', ':', '___EOS___']", "index": 125 } ]
[ { "span": "class MessageColumn(Column):", "start_line": 122, "start_column": 0, "end_line": 122, "end_column": 28 } ]
[ { "span": "def __init__(self, layout):", "start_line": 15, "start_column": 4, "end_line": 15, "end_column": 31 }, { "span": "def __init__(self, layout):", "start_line": 125, "start_column": 4, "end_line": 125, "end_column": 31 } ]
1
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "class_", "Column_", "(_", "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_", ",_", "layout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "width_", "=_", "layout_", "._", "config_", "._", "get", "\\u", "column", "\\u", "width_", "(_", "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_", "Messag", "e", "Column_", "(_", "Column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "NAME_", "=_", "\"", "message", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "WIDTH_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Messag", "e", "Column_", "(_", "Column_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "layout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "width_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left_", "=_", "layout_", "._", "total", "\\u", "column", "\\u", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "layout_", "._", "config_", "._", "get", "\\u", "wrap_", "(_", ")_", "and_", "(_", "not_", "layout_", "._", "profile_", "or_", "layout_", "._", "profile_", "._", "wrap_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "width_", "=_", "layout_", "._", "width_", "-_", "self_", "._", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 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, 4, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 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 ]
Unused import
jarus/flask-rst/flaskrst/modules/pygments.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\n flaskrst.modules.pygments\n ~~~~~~~~~~~~~~~~~~~~~~~~~\n\n :copyright: (c) 2011 by Christoph Heer.\n :license: BSD, see LICENSE for more details.\n\"\"\"\n\nfrom __future__ import absolute_import\nfrom docutils import nodes\nfrom docutils.parsers.rst import directives, Directive\n\nfrom hashlib import sha1\nfrom flask import url_for, make_response, request, abort\n\ntry:\n from pygments import highlight\n from pygments.lexers import get_lexer_by_name, TextLexer\n from pygments.formatters import HtmlFormatter\nexcept ImportError:\n import sys\n sys.exit(\"To use pygments in flask-rst you must install pygments\")\n\nformatter = HtmlFormatter()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Pygments(Directive):\n required_arguments = 1\n optional_arguments = 0\n final_argument_whitespace = True\n has_content = True\n", "metadata": "root.Pygments", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def run(self):\n self.assert_has_content()\n try:\n lexer = get_lexer_by_name(self.arguments[0])\n except ValueError:\n lexer = TextLexer()\n parsed = highlight(u'\\n'.join(self.content), lexer, formatter)\n return [nodes.raw('', parsed, format='html')]", "metadata": "root.Pygments.run", "header": "['class', 'Pygments', '(', 'Directive', ')', ':', '___EOS___']", "index": 32 }, { "content": "def setup(app, cfg):\n global formatter\n formatter = HtmlFormatter(style=cfg.get('style', 'tango'))\n directives.register_directive('sourcecode', Pygments)\n directives.register_directive('code-block', Pygments)\n \n @app.route(cfg.get('css_file_route', \"/static/pygments.css\"))\n def pygments_css():\n etag = sha1(str(formatter.style)).hexdigest()\n if request.headers.get('If-None-Match') == etag:\n return \"\", 304\n else:\n res = make_response(formatter.get_style_defs())\n res.mimetype = \"text/css\"\n res.headers['ETag'] = etag\n return res\n \n @app.before_request\n def inject_pygments_css():\n if url_for('pygments_css') not in app.config['STYLESHEETS']:\n app.config['STYLESHEETS'].append(url_for('pygments_css'))", "metadata": "root.setup", "header": "['module', '___EOS___']", "index": 41 } ]
[ { "span": "from flask import url_for, make_response, request, abort", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 56 } ]
[]
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", "skr", "st", ".", "module", "s", ".", "pyg", "ment", "s", "\\", "10", ";", " ", " ", " ", " ", "~~~~~~~~~~~", "~~~~~~~~~~~", "~~~", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "copyr", "ight", ":", " ", "(", "c", ")", " ", "2011", " ", "by", " ", "Christ", "oph", " ", "He", "er", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "license", ":", " ", "BS", "D", ",", " ", "see", " ", "LICENSE", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "docutils_", "import_", "nodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "docutils_", "._", "parsers_", "._", "rst_", "import_", "directives_", ",_", "Directive", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "hashlib_", "import_", "sha1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "url", "\\u", "for_", ",_", "make", "\\u", "response_", ",_", "request_", ",_", "abort_", "\\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_", "pygments_", "import_", "highlight_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pygments_", "._", "lexer", "s_", "import_", "get", "\\u", "lexer", "\\u", "by", "\\u", "name_", ",_", "Text", "Lexer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pygments_", "._", "formatters_", "import_", "Ht", "ml", "Formatter_", "\\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_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "\"", "To", " ", "use", " ", "pyg", "ment", "s", " ", "in", " ", "fla", "sk", "-", "rst", " ", "you", " ", "must", " ", "install", " ", "pyg", "ment", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "formatter_", "=_", "Ht", "ml", "Formatter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Pyg", "ments_", "(_", "Directive", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "require", "d\\u", "arguments_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "al", "\\u", "arguments_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "\\u", "argu", "ment", "\\u", "whitespace_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "content_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Pyg", "ments_", "(_", "Directive", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "\\u", "has", "\\u", "content_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lexer_", "=_", "get", "\\u", "lexer", "\\u", "by", "\\u", "name_", "(_", "self_", "._", "arguments_", "[_", "0_", "]_", ")_", "\\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 ", " _", "lexer_", "=_", "Text", "Lexer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parsed_", "=_", "highlight_", "(_", "u", "'\\\\", "n", "'_", "._", "join_", "(_", "self_", "._", "content_", ")_", ",_", "lexer_", ",_", "formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "nodes_", "._", "raw_", "(_", "''_", ",_", "parsed_", ",_", "format_", "=_", "'", "html", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup_", "(_", "app_", ",_", "cfg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "formatter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formatter_", "=_", "Ht", "ml", "Formatter_", "(_", "style_", "=_", "cfg_", "._", "get_", "(_", "'", "style", "'_", ",_", "'", "tang", "o", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "directives_", "._", "register", "\\u", "directive_", "(_", "'", "source", "code", "'_", ",_", "Pyg", "ments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "directives_", "._", "register", "\\u", "directive_", "(_", "'", "code", "-", "block", "'_", ",_", "Pyg", "ments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "cfg_", "._", "get_", "(_", "'", "css", "\\u", "file", "\\u", "route", "'_", ",_", "\"/", "static", "/", "pyg", "ment", "s", ".", "css", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pyg", "ment", "s", "\\u", "css_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etag_", "=_", "sha1_", "(_", "str_", "(_", "formatter_", "._", "style_", ")_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "headers_", "._", "get_", "(_", "'", "If", "-", "Non", "e-", "Match", "'_", ")_", "==_", "etag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", ",_", "304_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "make", "\\u", "response_", "(_", "formatter_", "._", "get", "\\u", "style", "\\u", "defs_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "mimetype_", "=_", "\"", "text", "/", "css", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "headers_", "[_", "'", "ET", "ag", "'_", "]_", "=_", "etag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "bef", "ore", "\\u", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "inject", "\\u", "pyg", "ment", "s", "\\u", "css_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "url", "\\u", "for_", "(_", "'", "pyg", "ment", "s", "\\u", "css", "'_", ")_", "not_", "in_", "app_", "._", "config_", "[_", "'", "STYLE", "SHE", "ET", "S", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "config_", "[_", "'", "STYLE", "SHE", "ET", "S", "'_", "]_", "._", "append_", "(_", "url", "\\u", "for_", "(_", "'", "pyg", "ment", "s", "\\u", "css", "'_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
zomux/deepy/deepy/trainers/__init__.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nTHEANO_LINKER = \"cvm\"\n\nfrom controllers import TrainingController\nfrom base import NeuralTrainer\nfrom trainers import *\nfrom optimize import *\nfrom annealers import *\nfrom customize_trainer import CustomizeTrainer\nfrom util import wrap_core, multiple_l2_norm\nfrom delayed_trainers import DelayedBatchSGDTrainer\nfrom scipy_trainer import ScipyTrainer\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from controllers import TrainingController", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 42 }, { "span": "from base import NeuralTrainer", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 30 }, { "span": "from customize_trainer import CustomizeTrainer", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 46 }, { "span": "from util import wrap_core, multiple_l2_norm", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 44 }, { "span": "from delayed_trainers import DelayedBatchSGDTrainer", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 51 }, { "span": "from scipy_trainer import ScipyTrainer", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "THE", "ANO", "\\u", "LINK", "ER_", "=_", "\"", "cv", "m", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "controllers_", "import_", "Train", "ing", "Controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "base_", "import_", "Neu", "ral", "Trainer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trainer", "s_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optimize_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "anne", "ale", "rs_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "customize", "\\u", "trainer_", "import_", "Customiz", "e", "Trainer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "util_", "import_", "wrap", "\\u", "core_", ",_", "multiple", "\\u", "l2", "\\u", "norm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "delayed", "\\u", "trainer", "s_", "import_", "Delay", "ed", "Bat", "ch", "SGD", "Trainer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sci", "py", "\\u", "trainer_", "import_", "Sci", "py", "Trainer", "_" ]
[ 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, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Except block handles 'BaseException'
cleesmith/sentdex_scikit_machine_learning_tutorial_for_investing/p09.py
[ { "content": "def Key_Stats(gather=\"Total Debt/Equity (mrq)\"):\n statspath = path+'/_KeyStats'\n stock_list = [x[0] for x in os.walk(statspath)]\n df = pd.DataFrame(\n columns = [\n 'Date',\n 'Unix',\n 'Ticker',\n 'DE Ratio',\n 'Price',\n 'stock_p_change',\n 'SP500',\n 'sp500_p_change',\n 'Difference'\n ]\n )\n\n sp500_df = pd.DataFrame.from_csv(\"YAHOO-INDEX_GSPC.csv\")\n\n ticker_list = []\n\n for each_dir in stock_list[1:25]:\n each_file = os.listdir(each_dir)\n\n # ticker = each_dir.split(\"\\\\\")[1] # Windows only\n # ticker = each_dir.split(\"/\")[1] # this didn't work so do this:\n ticker = os.path.basename(os.path.normpath(each_dir))\n # print(ticker) # uncomment to verify\n ticker_list.append(ticker)\n\n starting_stock_value = False\n starting_sp500_value = False\n \n if len(each_file) > 0:\n for file in each_file:\n date_stamp = datetime.strptime(file, '%Y%m%d%H%M%S.html')\n unix_time = time.mktime(date_stamp.timetuple())\n full_file_path = each_dir+'/'+file\n source = open(full_file_path,'r').read()\n try:\n try:\n value = float(source.split(gather+':</td><td class=\"yfnc_tabledata1\">')[1].split('</td>')[0])\n except Exception as e:\n\n try:\n value = float(source.split(gather+':</td>\\n<td class=\"yfnc_tabledata1\">')[1].split('</td>')[0])\n #print(str(e),ticker, file)\n except Exception as e:\n pass\n #print(str(e),ticker, file)\n #time.sleep(15)\n #value = float(source.split(gather+':</td>\\n<td class=\"yfnc_tabledata1\">')[1].split('</td>')[0])\n\n try:\n sp500_date = datetime.fromtimestamp(unix_time).strftime('%Y-%m-%d')\n row = sp500_df[(sp500_df.index == sp500_date)]\n sp500_value = float(row[\"Adj Close\"])\n except:\n sp500_date = datetime.fromtimestamp(unix_time-259200).strftime('%Y-%m-%d')\n row = sp500_df[(sp500_df.index == sp500_date)]\n sp500_value = float(row[\"Adj Close\"])\n\n try:\n stock_price = float(source.split('</small><big><b>')[1].split('</b></big>')[0])\n except Exception as e:\n # <span id=\"yfs_l10_afl\">43.27</span>\n try:\n stock_price = (source.split('</small><big><b>')[1].split('</b></big>')[0])\n stock_price = re.search(r'(\\d{1,8}\\.\\d{1,8})',stock_price)\n stock_price = float(stock_price.group(1))\n #print(stock_price)\n except Exception as e:\n try:\n stock_price = (source.split('<span class=\"time_rtq_ticker\">')[1].split('</span>')[0])\n stock_price = re.search(r'(\\d{1,8}\\.\\d{1,8})',stock_price)\n stock_price = float(stock_price.group(1))\n except Exception as e:\n print(str(e),'a;lsdkfh',file,ticker)\n\n #print('Latest:',stock_price)\n #print('stock price',str(e),ticker,file)\n #time.sleep(15)\n \n #print(\"stock_price:\",stock_price,\"ticker:\", ticker)\n\n if not starting_stock_value:\n starting_stock_value = stock_price\n if not starting_sp500_value:\n starting_sp500_value = sp500_value\n\n stock_p_change = ((stock_price - starting_stock_value) / starting_stock_value) * 100\n sp500_p_change = ((sp500_value - starting_sp500_value) / starting_sp500_value) * 100\n\n df = df.append({'Date':date_stamp,\n 'Unix':unix_time,\n 'Ticker':ticker,\n 'DE Ratio':value,\n 'Price':stock_price,\n 'stock_p_change':stock_p_change,\n 'SP500':sp500_value,\n 'sp500_p_change':sp500_p_change,\n 'Difference':stock_p_change - sp500_p_change},\n ignore_index = True\n )\n except Exception as e:\n pass\n #print(str(e))\n\n for each_ticker in ticker_list:\n try:\n # print(\"each_ticker=%s\"%each_ticker)\n plot_df = df[(df['Ticker'] == each_ticker)]\n plot_df = plot_df.set_index(['Date'])\n plot_df['Difference'].plot(label=each_ticker)\n plt.legend()\n except:\n pass\n\n plt.show()\n\n save = gather.replace(' ','').replace(')','').replace('(','').replace('/','')+('.csv')\n print(save)\n df.to_csv(save)", "metadata": "root.Key_Stats", "header": "['module', '___EOS___']", "index": 16 } ]
[ { "span": "except:", "start_line": 73, "start_column": 10, "end_line": 73, "end_column": 17 }, { "span": "except:", "start_line": 131, "start_column": 4, "end_line": 131, "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_", "Key", "\\u", "Stats_", "(_", "gather_", "=_", "\"", "Total", " ", "Deb", "t", "/", "Equi", "ty", " ", "(", "mr", "q", ")\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stats", "path_", "=_", "path_", "+_", "'/\\", "u", "Key", "Stat", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stock", "\\u", "list_", "=_", "[_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "os_", "._", "walk_", "(_", "stats", "path_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "pd_", "._", "Data", "Frame_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "columns_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Date", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Uni", "x", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ticke", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DE", " ", "Rati", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Price", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stock", "\\u", "p", "\\u", "change", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SP", "500", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sp", "500", "\\u", "p", "\\u", "change", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Difference", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sp", "500", "\\u", "df_", "=_", "pd_", "._", "Data", "Frame_", "._", "from", "\\u", "csv_", "(_", "\"", "YA", "HO", "O", "-", "INDE", "X", "\\u", "GS", "PC", ".", "csv", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ticker", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "each", "\\u", "dir_", "in_", "stock", "\\u", "list_", "[_", "1_", ":_", "25_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "each", "\\u", "file_", "=_", "os_", "._", "listdir_", "(_", "each", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ticker", " ", "=", " ", "each", "\\u", "dir", ".", "split", "(\"", "\\\\\\\\\"", ")[", "1", "]", " ", "#", " ", "Window", "s", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ticker", " ", "=", " ", "each", "\\u", "dir", ".", "split", "(\"", "/\"", ")[", "1", "]", " ", "#", " ", "this", " ", "did", "n", "'", "t", " ", "work", " ", "so", " ", "do", " ", "this", ":_", "\\u\\u\\uNL\\u\\u\\u_", "ticker_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "os_", "._", "path_", "._", "normpath_", "(_", "each", "\\u", "dir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(", "ticker", ")", " ", "#", " ", "uncomm", "ent", " ", "to", " ", "verify_", "\\u\\u\\uNL\\u\\u\\u_", "ticker", "\\u", "list_", "._", "append_", "(_", "ticker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "startin", "g", "\\u", "stock", "\\u", "value_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "startin", "g", "\\u", "sp", "500", "\\u", "value_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "each", "\\u", "file_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "file_", "in_", "each", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "date", "\\u", "stamp_", "=_", "datetime_", "._", "strptime_", "(_", "file_", ",_", "'%", "Y", "%", "m", "%", "d", "%", "H", "%", "M", "%", "S", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unix", "\\u", "time_", "=_", "time_", "._", "mktime_", "(_", "date", "\\u", "stamp_", "._", "timetuple_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "\\u", "file", "\\u", "path_", "=_", "each", "\\u", "dir_", "+_", "'/'_", "+_", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "open_", "(_", "full", "\\u", "file", "\\u", "path_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "float_", "(_", "source_", "._", "split_", "(_", "gather_", "+_", "':", "</", "td", "><", "td", " ", "class", "=\"", "yf", "nc", "\\u", "table", "data", "1", "\">'_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "'<", "/", "td", ">'_", ")_", "[_", "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\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "float_", "(_", "source_", "._", "split_", "(_", "gather_", "+_", "':", "</", "td", ">\\\\", "n", "<", "td", " ", "class", "=\"", "yf", "nc", "\\u", "table", "data", "1", "\">'_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "'<", "/", "td", ">'_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "(", "str", "(", "e", "),", "ticker", ",", " ", "file", ")_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "(", "str", "(", "e", "),", "ticker", ",", " ", "file", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "time", ".", "sleep", "(", "15", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "value", " ", "=", " ", "float", "(", "source", ".", "split", "(", "gather", "+'", ":", "</", "td", ">\\\\", "n", "<", "td", " ", "class", "=\"", "yf", "nc", "\\u", "table", "data", "1", "\">", "')", "[", "1", "].", "split", "('", "</", "td", ">'", ")[", "0", "])", "_", "\\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 ", " _", "sp", "500", "\\u", "date_", "=_", "datetime_", "._", "fromtimestamp_", "(_", "unix", "\\u", "time_", ")_", "._", "strftime_", "(_", "'%", "Y", "-%", "m", "-%", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "sp", "500", "\\u", "df_", "[_", "(_", "sp", "500", "\\u", "df_", "._", "index_", "==_", "sp", "500", "\\u", "date_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sp", "500", "\\u", "value_", "=_", "float_", "(_", "row_", "[_", "\"", "Adj", " ", "Clos", "e", "\"_", "]_", ")_", "\\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 ", " _", "sp", "500", "\\u", "date_", "=_", "datetime_", "._", "fromtimestamp_", "(_", "unix", "\\u", "time_", "-_", "259", "200_", ")_", "._", "strftime_", "(_", "'%", "Y", "-%", "m", "-%", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "sp", "500", "\\u", "df_", "[_", "(_", "sp", "500", "\\u", "df_", "._", "index_", "==_", "sp", "500", "\\u", "date_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sp", "500", "\\u", "value_", "=_", "float_", "(_", "row_", "[_", "\"", "Adj", " ", "Clos", "e", "\"_", "]_", ")_", "\\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 ", " _", "stock", "\\u", "price_", "=_", "float_", "(_", "source_", "._", "split_", "(_", "'<", "/", "small", "><", "big", "><", "b", ">'_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "'<", "/", "b", "><", "/", "big", ">'_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "<", "span", " ", "id", "=\"", "yf", "s", "\\u", "l10", "\\u", "af", "l", "\">", "43.", "2", "7", "</", "span", ">_", "\\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 ", " _", "stock", "\\u", "price_", "=_", "(_", "source_", "._", "split_", "(_", "'<", "/", "small", "><", "big", "><", "b", ">'_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "'<", "/", "b", "><", "/", "big", ">'_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stock", "\\u", "price_", "=_", "re_", "._", "search_", "(_", "r", "'(\\\\", "d", "{", "1", ",", "8", "}\\\\.", "\\\\", "d", "{", "1", ",", "8", "})'_", ",_", "stock", "\\u", "price_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stock", "\\u", "price_", "=_", "float_", "(_", "stock", "\\u", "price_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "(", "stock", "\\u", "price", ")_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stock", "\\u", "price_", "=_", "(_", "source_", "._", "split_", "(_", "'<", "span", " ", "class", "=\"", "time", "\\u", "rt", "q", "\\u", "ticker", "\">'_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "'<", "/", "span", ">'_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stock", "\\u", "price_", "=_", "re_", "._", "search_", "(_", "r", "'(\\\\", "d", "{", "1", ",", "8", "}\\\\.", "\\\\", "d", "{", "1", ",", "8", "})'_", ",_", "stock", "\\u", "price_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stock", "\\u", "price_", "=_", "float_", "(_", "stock", "\\u", "price_", "._", "group_", "(_", "1_", ")_", ")_", "\\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 ", " _", "print_", "(_", "str_", "(_", "e_", ")_", ",_", "'", "a", ";", "ls", "dk", "fh", "'_", ",_", "file_", ",_", "ticker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", "('", "Late", "st", ":'", ",", "stock", "\\u", "price", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", "('", "stock", " ", "price", "',", "str", "(", "e", "),", "ticker", ",", "file", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "time", ".", "sleep", "(", "15", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", "(\"", "stock", "\\u", "price", ":\"", ",", "stock", "\\u", "price", ",\"", "ticker", ":\"", ",", " ", "ticker", ")_", "\\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_", "not_", "startin", "g", "\\u", "stock", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "startin", "g", "\\u", "stock", "\\u", "value_", "=_", "stock", "\\u", "price_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "startin", "g", "\\u", "sp", "500", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "startin", "g", "\\u", "sp", "500", "\\u", "value_", "=_", "sp", "500", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stock", "\\u", "p", "\\u", "change_", "=_", "(_", "(_", "stock", "\\u", "price_", "-_", "startin", "g", "\\u", "stock", "\\u", "value_", ")_", "/_", "startin", "g", "\\u", "stock", "\\u", "value_", ")_", "*_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sp", "500", "\\u", "p", "\\u", "change_", "=_", "(_", "(_", "sp", "500", "\\u", "value_", "-_", "startin", "g", "\\u", "sp", "500", "\\u", "value_", ")_", "/_", "startin", "g", "\\u", "sp", "500", "\\u", "value_", ")_", "*_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df_", "=_", "df_", "._", "append_", "(_", "{_", "'", "Date", "'_", ":_", "date", "\\u", "stamp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Uni", "x", "'_", ":_", "unix", "\\u", "time_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ticke", "r", "'_", ":_", "ticker_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DE", " ", "Rati", "o", "'_", ":_", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Price", "'_", ":_", "stock", "\\u", "price_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stock", "\\u", "p", "\\u", "change", "'_", ":_", "stock", "\\u", "p", "\\u", "change_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SP", "500", "'_", ":_", "sp", "500", "\\u", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sp", "500", "\\u", "p", "\\u", "change", "'_", ":_", "sp", "500", "\\u", "p", "\\u", "change_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Difference", "'_", ":_", "stock", "\\u", "p", "\\u", "change_", "-_", "sp", "500", "\\u", "p", "\\u", "change_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "index_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "(", "str", "(", "e", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "each", "\\u", "ticker_", "in_", "ticker", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(\"", "each", "\\u", "ticker", "=", "%", "s", "\"%", "each", "\\u", "ticker", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plot", "\\u", "df_", "=_", "df_", "[_", "(_", "df_", "[_", "'", "Ticke", "r", "'_", "]_", "==_", "each", "\\u", "ticker_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot", "\\u", "df_", "=_", "plot", "\\u", "df_", "._", "set\\u", "index_", "(_", "[_", "'", "Date", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot", "\\u", "df_", "[_", "'", "Difference", "'_", "]_", "._", "plot_", "(_", "label_", "=_", "each", "\\u", "ticker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "legend_", "(_", ")_", "\\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_", "plt_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "save_", "=_", "gather_", "._", "replace_", "(_", "'", " ", "'_", ",_", "''_", ")_", "._", "replace_", "(_", "')'_", ",_", "''_", ")_", "._", "replace_", "(_", "'('_", ",_", "''_", ")_", "._", "replace_", "(_", "'/'_", ",_", "''_", ")_", "+_", "(_", "'.", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "save_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "._", "to", "\\u", "csv_", "(_", "save_", ")_", "\\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,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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, 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 ]
Import of deprecated module
cournape/Bento/bento/private/_yaku/examples/2to3/foo/__init__.py
[ { "content": "try:\n import md5\nexcept ImportError, e:\n import hashlib\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "md5", "start_line": 1, "start_column": 11, "end_line": 1, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Import_", "of_", "deprecated_", "module_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "md5_", "\\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_", "hashlib_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Missing call to `__init__` during object initialization
EricssonResearch/calvin-base/calvin/actorstore/tests/test_actors.py
[ { "content": " def __init__(self, fname, mode):\n self.fp = open(fname, mode)\n if 'r' in mode:\n self.buffer = self.fp.read()\n else:\n self.buffer = \"\"", "metadata": "root.FDMock.__init__", "header": "['class', 'FDMock', '(', 'object', ')', ':', '___EOS___']", "index": 98 }, { "content": "class StdInMock(FDMock):", "metadata": "root.StdInMock", "header": "['module', '___EOS___']", "index": 136 }, { "content": " def __init__(self):\n self.buffer = \"stdin\\nstdin_second_line\"", "metadata": "root.StdInMock.__init__", "header": "['class', 'StdInMock', '(', 'FDMock', ')', ':', '___EOS___']", "index": 137 } ]
[ { "span": "class StdInMock(FDMock):", "start_line": 136, "start_column": 0, "end_line": 136, "end_column": 24 } ]
[ { "span": "def __init__(self, fname, mode):", "start_line": 98, "start_column": 4, "end_line": 98, "end_column": 36 }, { "span": "def __init__(self):", "start_line": 137, "start_column": 4, "end_line": 137, "end_column": 23 } ]
1
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "class_", "FD", "Mock_", "(_", "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_", ",_", "fname_", ",_", "mode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fp_", "=_", "open_", "(_", "fname_", ",_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "r", "'_", "in_", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "buffer_", "=_", "self_", "._", "fp_", "._", "read_", "(_", ")_", "\\u\\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_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Std", "In", "Mock_", "(_", "FD", "Mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Std", "In", "Mock_", "(_", "FD", "Mock_", ")_", ":_", "\\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_", "._", "buffer_", "=_", "\"", "std", "in", "\\\\", "nst", "din", "\\u", "second", "\\u", "line", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 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, 4, 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, 3, 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 ]
Testing equality to None
Arelle/Arelle/arelle/ViewWinRenderedGrid.py
[ { "content": " def getbackgroundColor(self, factPrototype):\n bgColor = XbrlTable.TG_BG_DEFAULT # default monetary\n concept = factPrototype.concept\n if concept == None:\n return bgColor\n isNumeric = concept.isNumeric\n # isMonetary = concept.isMonetary\n isInteger = concept.baseXbrliType in integerItemTypes\n isPercent = concept.typeQname in (qnPercentItemType, qnPureItemType)\n isString = concept.baseXbrliType in (\"stringItemType\", \"normalizedStringItemType\")\n isDate = concept.baseXbrliType in (\"dateTimeItemType\", \"dateItemType\")\n if isNumeric:\n if concept.isShares or isInteger:\n bgColor = XbrlTable.TG_BG_ORANGE\n elif isPercent:\n bgColor = XbrlTable.TG_BG_YELLOW\n # else assume isMonetary\n elif isDate:\n bgColor = XbrlTable.TG_BG_GREEN\n elif isString:\n bgColor = XbrlTable.TG_BG_VIOLET\n return bgColor;", "metadata": "root.ViewRenderedGrid.getbackgroundColor", "header": "['class', 'ViewRenderedGrid', '(', 'ViewWinTkTable', '.', 'ViewTkTable', ')', ':', '___EOS___']", "index": 556 } ]
[ { "span": "concept == None:", "start_line": 559, "start_column": 11, "end_line": 559, "end_column": 26 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "View", "Render", "ed", "Grid_", "(_", "View", "Win", "Tk", "Table_", "._", "View", "Tk", "Table_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getb", "ack", "ground", "Color_", "(_", "self_", ",_", "fact", "Prototype", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "Color_", "=_", "Xbrl", "Table_", "._", "TG", "\\u", "BG", "\\u", "DEFAULT_", "#", " ", "default", " ", "mone", "tar", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "concept_", "=_", "fact", "Prototype", "_", "._", "concept_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "concept_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bg", "Color_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "is", "Numeric_", "=_", "concept_", "._", "is", "Numeric_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "is", "Mone", "tar", "y", " ", "=", " ", "concept", ".", "is", "Mone", "tar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "is", "Integer_", "=_", "concept_", "._", "base", "Xbrl", "i", "Type_", "in_", "integ", "er", "Item", "Types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Percent_", "=_", "concept_", "._", "type", "Qn", "ame_", "in_", "(_", "qn", "Perce", "nt", "Item", "Type_", ",_", "qn", "Pur", "e", "Item", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "String_", "=_", "concept_", "._", "base", "Xbrl", "i", "Type_", "in_", "(_", "\"", "string", "Item", "Type", "\"_", ",_", "\"", "normali", "zed", "String", "Item", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Date_", "=_", "concept_", "._", "base", "Xbrl", "i", "Type_", "in_", "(_", "\"", "date", "Time", "Item", "Type", "\"_", ",_", "\"", "date", "Item", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Numeric_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "concept_", "._", "is", "Share", "s_", "or_", "is", "Integer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "Color_", "=_", "Xbrl", "Table_", "._", "TG", "\\u", "BG", "\\u", "ORA", "NGE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "Percent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "Color_", "=_", "Xbrl", "Table_", "._", "TG", "\\u", "BG", "\\u", "YELLOW_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "else", " ", "assume", " ", "is", "Mone", "tar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "Date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "Color_", "=_", "Xbrl", "Table_", "._", "TG", "\\u", "BG", "\\u", "GREEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "String_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "Color_", "=_", "Xbrl", "Table_", "._", "TG", "\\u", "BG", "\\u", "VIO", "LET", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "bg", "Color_", ";_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/test/test_hasconstraints.py
[ { "content": " def test_get_2sided_constraints(self):\n drv = self.asm.add('driver', My2SDriver())\n drv.add_constraint('-44.1 < comp1.a < 13.0')\n drv.add_constraint('77.0 < comp1.c < 79.0')\n self.asm.run()\n\n cons = drv.get_2sided_constraints()\n self.assertTrue(len(cons) == 2)\n con1 = cons['-44.1<comp1.a<13.0']\n self.assertEqual(self.asm.comp1.a, con1.evaluate(self.asm)[0])\n self.assertEqual(con1.low, -44.1)\n self.assertEqual(con1.high, 13.0)\n con1 = cons['77.0<comp1.c<79.0']\n self.assertEqual(self.asm.comp1.c, con1.evaluate(self.asm)[0])\n self.assertEqual(con1.low, 77.0)\n self.assertEqual(con1.high, 79.0)\n\n cons = drv.get_constraints()\n self.assertTrue(len(cons) == 0)", "metadata": "root.Has2SidedConstraintsTestCase.test_get_2sided_constraints", "header": "['class', 'Has2SidedConstraintsTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 626 }, { "content": " def test_list_constraints(self):\n drv = self.asm.add('driver', My2SDriver())\n drv.add_constraint('-44.1 < comp1.a < 13.0')\n drv.add_constraint('77.0 < comp1.c')\n self.asm.run()\n\n cons = drv.list_constraints()\n self.assertTrue('-44.1<comp1.a<13.0' in cons)\n self.assertTrue('77.0<comp1.c' in cons)", "metadata": "root.Has2SidedConstraintsTestCase.test_list_constraints", "header": "['class', 'Has2SidedConstraintsTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 646 } ]
[ { "span": "self.assertTrue(len(cons) == 2)", "start_line": 633, "start_column": 8, "end_line": 633, "end_column": 39 }, { "span": "self.assertTrue(len(cons) == 0)", "start_line": 644, "start_column": 8, "end_line": 644, "end_column": 39 }, { "span": "self.assertTrue('-44.1<comp1.a<13.0' in cons)", "start_line": 653, "start_column": 8, "end_line": 653, "end_column": 53 }, { "span": "self.assertTrue('77.0<comp1.c' in cons)", "start_line": 654, "start_column": 8, "end_line": 654, "end_column": 47 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Has", "2", "Side", "d", "Constr", "aint", "s", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "2s", "ide", "d\\u", "constraints_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drv_", "=_", "self_", "._", "asm_", "._", "add_", "(_", "'", "driver", "'_", ",_", "My", "2", "SD", "river", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drv_", "._", "add", "\\u", "constraint_", "(_", "'-", "44.", "1", " ", "<", " ", "comp", "1", ".", "a", " ", "<", " ", "13.", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drv_", "._", "add", "\\u", "constraint_", "(_", "'", "77.", "0", " ", "<", " ", "comp", "1", ".", "c", " ", "<", " ", "79.", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "asm_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cons_", "=_", "drv_", "._", "get", "\\u", "2s", "ide", "d\\u", "constraints_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "cons_", ")_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "con", "1_", "=_", "cons_", "[_", "'-", "44.", "1", "<", "comp", "1", ".", "a", "<", "13.", "0", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "asm_", "._", "comp", "1_", "._", "a_", ",_", "con", "1_", "._", "evaluate_", "(_", "self_", "._", "asm_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "con", "1_", "._", "low_", ",_", "-_", "44.", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "con", "1_", "._", "high_", ",_", "13.", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "con", "1_", "=_", "cons_", "[_", "'", "77.", "0", "<", "comp", "1", ".", "c", "<", "79.", "0", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "asm_", "._", "comp", "1_", "._", "c_", ",_", "con", "1_", "._", "evaluate_", "(_", "self_", "._", "asm_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "con", "1_", "._", "low_", ",_", "77.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "con", "1_", "._", "high_", ",_", "79.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cons_", "=_", "drv_", "._", "get", "\\u", "constraints_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "cons_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Has", "2", "Side", "d", "Constr", "aint", "s", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "constraints_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drv_", "=_", "self_", "._", "asm_", "._", "add_", "(_", "'", "driver", "'_", ",_", "My", "2", "SD", "river", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drv_", "._", "add", "\\u", "constraint_", "(_", "'-", "44.", "1", " ", "<", " ", "comp", "1", ".", "a", " ", "<", " ", "13.", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drv_", "._", "add", "\\u", "constraint_", "(_", "'", "77.", "0", " ", "<", " ", "comp", "1", ".", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "asm_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cons_", "=_", "drv_", "._", "list", "\\u", "constraints_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'-", "44.", "1", "<", "comp", "1", ".", "a", "<", "13.", "0", "'_", "in_", "cons_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "77.", "0", "<", "comp", "1", ".", "c", "'_", "in_", "cons_", ")_", "\\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, 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, 2, 2, 2, 2, 2, 0, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
Cal-CS-61A-Staff/ok-client/tests/utils/software_update_test.py
[ { "content": "from client.utils import software_update\nimport client\nimport json\nimport mock\nimport unittest\nimport urllib.error\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CheckVersionTest(unittest.TestCase):\n SERVER = 'test.server'\n PREVIOUS_VERSION = 'v1.1.1'\n CURRENT_VERSION = 'v1.2.3'\n CURRENT_DOWNLOAD_LINK = 'download/link'\n FILE_NAME = 'ok'\n\n\n\n\n\n", "metadata": "root.CheckVersionTest", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def setUp(self):\n self.patcherRequest = mock.patch('urllib.request.Request')\n self.addCleanup(self.patcherRequest.stop)\n self.mockRequest = self.patcherRequest.start()\n\n self.patcherUrlopen = mock.patch('urllib.request.urlopen')\n self.addCleanup(self.patcherUrlopen.stop)\n self.mockUrlopen = self.patcherUrlopen.start()\n\n self.mockRead = self.mockUrlopen.return_value.read\n self.mockDecode = self.mockUrlopen.return_value.read.return_value.decode\n\n self.patcherWriteZip = mock.patch('client.utils.software_update._write_zip')\n self.addCleanup(self.patcherWriteZip.stop)\n self.mockWriteZip = self.patcherWriteZip.start()", "metadata": "root.CheckVersionTest.setUp", "header": "['class', 'CheckVersionTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 14 }, { "content": " def createVersionApiJson(self, current_version, current_download_link):\n self.mockDecode.return_value = json.dumps({\n 'data': {\n 'results': [\n {\n 'current_version': current_version,\n 'current_download_link': current_download_link,\n }\n ]\n }\n })", "metadata": "root.CheckVersionTest.createVersionApiJson", "header": "['class', 'CheckVersionTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 30 }, { "content": " def testMalformedApiResponse(self):\n self.mockDecode.return_value = json.dumps({'data': []})\n self.assertFalse(software_update.check_version(self.SERVER,\n self.CURRENT_VERSION,\n self.FILE_NAME))", "metadata": "root.CheckVersionTest.testMalformedApiResponse", "header": "['class', 'CheckVersionTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 42 }, { "content": " def testUpToDate(self):\n self.createVersionApiJson(self.CURRENT_VERSION,\n self.CURRENT_DOWNLOAD_LINK)\n\n self.assertTrue(software_update.check_version(self.SERVER,\n self.CURRENT_VERSION,\n self.FILE_NAME))\n self.assertFalse(self.mockWriteZip.called)", "metadata": "root.CheckVersionTest.testUpToDate", "header": "['class', 'CheckVersionTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 48 }, { "content": " def testNeedsUpdate(self):\n self.createVersionApiJson(self.CURRENT_VERSION,\n self.CURRENT_DOWNLOAD_LINK)\n\n self.assertTrue(software_update.check_version(self.SERVER,\n self.PREVIOUS_VERSION,\n self.FILE_NAME))\n expected_zip_call = ((self.FILE_NAME, self.mockRead.return_value),)\n self.assertEqual(expected_zip_call, self.mockWriteZip.call_args)", "metadata": "root.CheckVersionTest.testNeedsUpdate", "header": "['class', 'CheckVersionTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 57 }, { "content": " def testWriteZip_IOError(self):\n self.createVersionApiJson(self.CURRENT_VERSION,\n self.CURRENT_DOWNLOAD_LINK)\n self.mockWriteZip.side_effect = IOError\n\n self.assertFalse(software_update.check_version(self.SERVER,\n self.PREVIOUS_VERSION,\n self.FILE_NAME))\n self.assertTrue(self.mockWriteZip.called)", "metadata": "root.CheckVersionTest.testWriteZip_IOError", "header": "['class', 'CheckVersionTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 67 } ]
[ { "span": "import client", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 13 }, { "span": "import urllib.error", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 19 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "client_", "._", "utils_", "import_", "software", "\\u", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "._", "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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Check", "Version", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "SERVER_", "=_", "'", "test", ".", "server", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PREVI", "OUS", "\\u", "VERSION_", "=_", "'", "v1", ".1", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CURREN", "T", "\\u", "VERSION_", "=_", "'", "v1", ".2", ".3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CURREN", "T", "\\u", "DOWNLOAD", "\\u", "LINK_", "=_", "'", "download", "/", "link", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FILE", "\\u", "NAME_", "=_", "'", "ok", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Check", "Version", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "patche", "r", "Request_", "=_", "mock_", "._", "patch_", "(_", "'", "url", "lib", ".", "request", ".", "Request", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Cleanup_", "(_", "self_", "._", "patche", "r", "Request_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mock", "Request_", "=_", "self_", "._", "patche", "r", "Request_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "patche", "r", "Ur", "lop", "en_", "=_", "mock_", "._", "patch_", "(_", "'", "url", "lib", ".", "request", ".", "urlo", "pen", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Cleanup_", "(_", "self_", "._", "patche", "r", "Ur", "lop", "en_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mock", "Ur", "lop", "en_", "=_", "self_", "._", "patche", "r", "Ur", "lop", "en_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mock", "Read_", "=_", "self_", "._", "mock", "Ur", "lop", "en_", "._", "return", "\\u", "value_", "._", "read_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mock", "Decode", "_", "=_", "self_", "._", "mock", "Ur", "lop", "en_", "._", "return", "\\u", "value_", "._", "read_", "._", "return", "\\u", "value_", "._", "decode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "patche", "r", "Write", "Zip", "_", "=_", "mock_", "._", "patch_", "(_", "'", "client", ".", "util", "s", ".", "software", "\\u", "update", ".\\u", "write", "\\u", "zip", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Cleanup_", "(_", "self_", "._", "patche", "r", "Write", "Zip", "_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mock", "Write", "Zip", "_", "=_", "self_", "._", "patche", "r", "Write", "Zip", "_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Check", "Version", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "Version", "Ap", "i", "Json_", "(_", "self_", ",_", "current", "\\u", "version_", ",_", "current", "\\u", "download", "\\u", "link_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Decode", "_", "._", "return", "\\u", "value_", "=_", "json_", "._", "dumps_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "results", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "current", "\\u", "version", "'_", ":_", "current", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "current", "\\u", "download", "\\u", "link", "'_", ":_", "current", "\\u", "download", "\\u", "link_", ",_", "\\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_", "[SEP]_", "class_", "Check", "Version", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Mal", "formed", "Ap", "i", "Response_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Decode", "_", "._", "return", "\\u", "value_", "=_", "json_", "._", "dumps_", "(_", "{_", "'", "data", "'_", ":_", "[_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "software", "\\u", "update_", "._", "check", "\\u", "version_", "(_", "self_", "._", "SERVER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURREN", "T", "\\u", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FILE", "\\u", "NAME_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Check", "Version", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Up", "To", "Date_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "create", "Version", "Ap", "i", "Json_", "(_", "self_", "._", "CURREN", "T", "\\u", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURREN", "T", "\\u", "DOWNLOAD", "\\u", "LINK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "software", "\\u", "update_", "._", "check", "\\u", "version_", "(_", "self_", "._", "SERVER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURREN", "T", "\\u", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FILE", "\\u", "NAME_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "mock", "Write", "Zip", "_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Check", "Version", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Ne", "eds", "Update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "create", "Version", "Ap", "i", "Json_", "(_", "self_", "._", "CURREN", "T", "\\u", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURREN", "T", "\\u", "DOWNLOAD", "\\u", "LINK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "software", "\\u", "update_", "._", "check", "\\u", "version_", "(_", "self_", "._", "SERVER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "PREVI", "OUS", "\\u", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FILE", "\\u", "NAME_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "zip", "\\u", "call_", "=_", "(_", "(_", "self_", "._", "FILE", "\\u", "NAME_", ",_", "self_", "._", "mock", "Read_", "._", "return", "\\u", "value_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected", "\\u", "zip", "\\u", "call_", ",_", "self_", "._", "mock", "Write", "Zip", "_", "._", "call", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Check", "Version", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Write", "Zip", "\\u", "IO", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "create", "Version", "Ap", "i", "Json_", "(_", "self_", "._", "CURREN", "T", "\\u", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURREN", "T", "\\u", "DOWNLOAD", "\\u", "LINK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mock", "Write", "Zip", "_", "._", "side", "\\u", "effect_", "=_", "IO", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "software", "\\u", "update_", "._", "check", "\\u", "version_", "(_", "self_", "._", "SERVER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "PREVI", "OUS", "\\u", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FILE", "\\u", "NAME_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "mock", "Write", "Zip", "_", "._", "called_", ")_" ]
[ 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, 0, 1, 1, 1, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
networkdynamics/zenlib/src/zen/tests/clustering.py
[ { "content": "import unittest\nimport random\nfrom zen import *\n\n# class WeakClusteringCoefficientTestCase(unittest.TestCase):\n# \t\n# \tdef test_simple(self):\n# \t\t\n# \t\tG = DiGraph()\n# \t\tG.add_edge('x','y')\n# \t\tG.add_edge('x','z')\n# \t\tG.add_edge('y','z')\n# \t\t\n# \t\tx = clustering.weak(G,nbunch=['x'],avg=True)\n# \t\tself.assertEqual(x,0.5)\n# \t\t\n# \t\tG.add_edge('z','y')\n# \t\tx = clustering.weak(G,nbunch=['x'],avg=True)\n# \t\tself.assertEqual(x,1.0)\n# \t\t\n# \t\tx = clustering.weak(G,avg=True)\n# \t\tself.assertAlmostEqual(x,0.333333333333333)\n# \t\n# \tdef test_bunch(self):\n# \t\tG = DiGraph()\n# \t\tnodes = range(30)\n# \t\tfor i in range(1000):\n# \t\t\tn1 = random.choice(nodes)\n# \t\t\tn2 = random.choice(nodes)\n# \t\t\t\n# \t\t\tif n1 != n2:\n# \t\t\t\tif (n1 not in G or n2 not in G) or not G.has_edge(n1,n2):\n# \t\t\t\t\tG.add_edge(n1,n2)\n# \t\t\t\n# \t\twccs = clustering.weak(G,nbunch=nodes)\n# \t\t\n# \t\tfor n,w in zip(nodes,wccs):\n# \t\t\tself.assertEqual(clustering.weak(G,nbunch=[n])[0],w)\n# \n# \t\t\n# \tdef test_zero_outdegree(self):\n# \t\t\n# \t\tG = DiGraph()\n# \t\tG.add_edge('x','y')\n# \t\t\n# \t\tx = clustering.weak(G,nbunch=['y'],avg=True)\n# \t\tself.assertEqual(x,0)\n# \t\t\n# \tdef test_simple2(self):\n# \t\tG = DiGraph()\n# \t\tn1 = G.add_node()\n# \t\tn2 = G.add_node()\n# \t\tG.add_edge_(n1,n2)\n# \t\t\n# \t\tfor i in range(2,100):\n# \t\t\tn = G.add_node()\n# \t\t\tG.add_edge_(n1,n)\n# \t\t\tG.add_edge_(n,n-1)\n# \t\t\n# \t\tG.add_edge_(n2,99)\t\n# \t\tx = clustering.weak(G,nbunch_=[n1])\n\t\t\n\t\t\n\t\t\n# class TTClusteringCoefficientTestCase(unittest.TestCase):\n# \n# \tdef test_simple(self):\n# \n# \t\tG = DiGraph()\n# \t\tG.add_edge('x','y')\n# \t\tG.add_edge('x','z')\n# \t\tG.add_edge('y','z')\n# \n# \t\tx = clustering.tt(G)\n# \t\tself.assertEqual(x,1.0)\n# \n# \t\tG.add_edge('z','y')\n# \t\tx = clustering.tt(G)\n# \t\tself.assertEqual(x,1.0)\n# \n# \tdef test_zero_outdegree(self):\n# \n# \t\tG = DiGraph()\n# \t\tG.add_edge('x','y')\n# \n# \t\tx = clustering.tt(G)\n# \t\tself.assertEqual(x,0)\n# \n# \tdef test_simple2(self):\n# \t\tG = DiGraph()\n# \t\tn1 = G.add_node()\n# \t\tn2 = G.add_node()\n# \t\tG.add_edge_(n1,n2)\n# \n# \t\tfor i in range(2,100):\n# \t\t\tn = G.add_node()\n# \t\t\tG.add_edge_(n1,n)\n# \t\t\tG.add_edge_(n,n-1)\n# \n# \t\tG.add_edge_(n2,99)\t\n# \t\tx = clustering.tt(G)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class LocalClusteringCoefficientTestCase(unittest.TestCase):\n\n\n", "metadata": "root.LocalClusteringCoefficientTestCase", "header": "['module', '___EOS___']", "index": 62 }, { "content": "\tdef test_simple(self):\n\n\t\tG = DiGraph()\n\t\tG.add_edge('x','y')\n\t\tG.add_edge('x','z')\n\t\tG.add_edge('y','z')\n\n\t\tx = clustering.lcc(G) #,nbunch=['x'],avg=True)\n\t\tself.assertEqual(x['x'],0.5)\n\n\t\tG.add_edge('z','y')\n\t\tx = clustering.lcc(G) #,nbunch=['x'],avg=True)\n\t\tself.assertEqual(x['x'],1.0)\n\n\t\tx = clustering.ncc(G) #,avg=True)\n\t\tself.assertAlmostEqual(x,0.333333333333333)", "metadata": "root.LocalClusteringCoefficientTestCase.test_simple", "header": "['class', 'LocalClusteringCoefficientTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 64 }, { "content": "\tdef test_zero_outdegree(self):\n\n\t\tG = DiGraph()\n\t\tG.add_edge('x','y')\n\n\t\tx = clustering.lcc(G) #,nbunch=['y'],avg=True)\n\t\tself.assertEqual(x['y'],0)", "metadata": "root.LocalClusteringCoefficientTestCase.test_zero_outdegree", "header": "['class', 'LocalClusteringCoefficientTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 81 }, { "content": "\tdef test_simple2(self):\n\t\tG = DiGraph()\n\t\tn1 = G.add_node()\n\t\tn2 = G.add_node()\n\t\tG.add_edge_(n1,n2)\n\n\t\tfor i in range(2,100):\n\t\t\tn = G.add_node()\n\t\t\tG.add_edge_(n1,n)\n\t\t\tG.add_edge_(n,n-1)\n\n\t\tG.add_edge_(n2,99)\t\n\t\tx = clustering.lcc(G)", "metadata": "root.LocalClusteringCoefficientTestCase.test_simple2", "header": "['class', 'LocalClusteringCoefficientTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 89 }, { "content": "class GlobalClusteringCoefficientTestCase(unittest.TestCase):\n\n\n\n", "metadata": "root.GlobalClusteringCoefficientTestCase", "header": "['module', '___EOS___']", "index": 103 }, { "content": "\tdef test_simple_dir(self):\n\n\t\tG = DiGraph()\n\t\tG.add_edge('x','y')\n\t\tG.add_edge('x','z')\n\t\tG.add_edge('y','z')\n\n\t\tx = clustering.gcc(G)\n\t\tself.assertEqual(x,0.5)\n\n\t\tG.add_edge('z','y')\n\t\tx = clustering.gcc(G)\n\t\tself.assertEqual(x,1.0)", "metadata": "root.GlobalClusteringCoefficientTestCase.test_simple_dir", "header": "['class', 'GlobalClusteringCoefficientTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 105 }, { "content": "\tdef test_simple_udir(self):\n\n\t\tG = Graph()\n\t\tG.add_edge('x','y')\n\t\tG.add_edge('x','z')\n\t\tG.add_edge('y','z')\n\n\t\tx = clustering.gcc(G)\n\t\tself.assertEqual(x,1.0)\n\n\t\tG.add_edge('z','w')\n\t\tx = clustering.gcc(G)\n\t\tself.assertAlmostEqual(x,3.0/5.0)", "metadata": "root.GlobalClusteringCoefficientTestCase.test_simple_udir", "header": "['class', 'GlobalClusteringCoefficientTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 119 }, { "content": "\tdef test_zero_outdegree(self):\n\n\t\tG = DiGraph()\n\t\tG.add_edge('x','y')\n\n\t\tx = clustering.gcc(G)\n\t\tself.assertEqual(x,0)", "metadata": "root.GlobalClusteringCoefficientTestCase.test_zero_outdegree", "header": "['class', 'GlobalClusteringCoefficientTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 133 }, { "content": "\tdef test_simple2(self):\n\t\tG = DiGraph()\n\t\tn1 = G.add_node()\n\t\tn2 = G.add_node()\n\t\tG.add_edge_(n1,n2)\n\n\t\tfor i in range(2,100):\n\t\t\tn = G.add_node()\n\t\t\tG.add_edge_(n1,n)\n\t\t\tG.add_edge_(n,n-1)\n\n\t\tG.add_edge_(n2,99)\t\n\t\tx = clustering.gcc(G)", "metadata": "root.GlobalClusteringCoefficientTestCase.test_simple2", "header": "['class', 'GlobalClusteringCoefficientTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 141 } ]
[ { "span": "import random", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zen", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "Wea", "k", "Clustering", "Coeff", "icient", "Test", "Case", "(", "unittest", ".", "Test", "Case", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\t", "def", " ", "test\\u", "simple", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", " ", "=", " ", "Di", "Graph", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", ".", "add", "\\u", "edge", "('", "x", "','", "y", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", ".", "add", "\\u", "edge", "('", "x", "','", "z", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", ".", "add", "\\u", "edge", "('", "y", "','", "z", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "x", " ", "=", " ", "clusteri", "ng", ".", "weak", "(", "G", ",", "nbu", "nch", "=[", "'", "x", "']", ",", "avg", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "self", ".", "assert", "Equal", "(", "x", ",", "0.", "5", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", ".", "add", "\\u", "edge", "('", "z", "','", "y", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "x", " ", "=", " ", "clusteri", "ng", ".", "weak", "(", "G", ",", "nbu", "nch", "=[", "'", "x", "']", ",", "avg", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "self", ".", "assert", "Equal", "(", "x", ",", "1.0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "x", " ", "=", " ", "clusteri", "ng", ".", "weak", "(", "G", ",", "avg", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "self", ".", "assert", "Al", "most", "Equal", "(", "x", ",", "0.333", "33333333333", "3", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\t", "def", " ", "test\\u", "bunch", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", " ", "=", " ", "Di", "Graph", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "nodes", " ", "=", " ", "range", "(", "30", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "for", " ", "i", " ", "in", " ", "range", "(", "1000", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "n1", " ", "=", " ", "random", ".", "choice", "(", "nodes", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "n2", " ", "=", " ", "random", ".", "choice", "(", "nodes", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "if", " ", "n1", " ", "!=", " ", "n2", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "\t", "if", " ", "(", "n1", " ", "not", " ", "in", " ", "G", " ", "or", " ", "n2", " ", "not", " ", "in", " ", "G", ")", " ", "or", " ", "not", " ", "G", ".", "has", "\\u", "edge", "(", "n1", ",", "n2", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t\t\t", "G", ".", "add", "\\u", "edge", "(", "n1", ",", "n2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "wc", "cs", " ", "=", " ", "clusteri", "ng", ".", "weak", "(", "G", ",", "nbu", "nch", "=", "nodes", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "for", " ", "n", ",", "w", " ", "in", " ", "zip", "(", "nodes", ",", "wc", "cs", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "self", ".", "assert", "Equal", "(", "clusteri", "ng", ".", "weak", "(", "G", ",", "nbu", "nch", "=[", "n", "])", "[", "0", "],", "w", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\t", "def", " ", "test\\u", "zero", "\\u", "outd", "egr", "ee", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", " ", "=", " ", "Di", "Graph", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", ".", "add", "\\u", "edge", "('", "x", "','", "y", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "x", " ", "=", " ", "clusteri", "ng", ".", "weak", "(", "G", ",", "nbu", "nch", "=[", "'", "y", "']", ",", "avg", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "self", ".", "assert", "Equal", "(", "x", ",", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\t", "def", " ", "test\\u", "simple", "2", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", " ", "=", " ", "Di", "Graph", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "n1", " ", "=", " ", "G", ".", "add", "\\u", "node", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "n2", " ", "=", " ", "G", ".", "add", "\\u", "node", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", ".", "add", "\\u", "edge", "\\u(", "n1", ",", "n2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "for", " ", "i", " ", "in", " ", "range", "(", "2", ",", "100", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "n", " ", "=", " ", "G", ".", "add", "\\u", "node", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "G", ".", "add", "\\u", "edge", "\\u(", "n1", ",", "n", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "G", ".", "add", "\\u", "edge", "\\u(", "n", ",", "n", "-1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", ".", "add", "\\u", "edge", "\\u(", "n2", ",", "9", "9", ")", "\t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "x", " ", "=", " ", "clusteri", "ng", ".", "weak", "(", "G", ",", "nbu", "nch", "\\u", "=[", "n1", "])", "_", "\\u\\u\\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_", "#", " ", "class", " ", "TTC", "luster", "ing", "Coeff", "icient", "Test", "Case", "(", "unittest", ".", "Test", "Case", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\t", "def", " ", "test\\u", "simple", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", " ", "=", " ", "Di", "Graph", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", ".", "add", "\\u", "edge", "('", "x", "','", "y", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", ".", "add", "\\u", "edge", "('", "x", "','", "z", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", ".", "add", "\\u", "edge", "('", "y", "','", "z", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "x", " ", "=", " ", "clusteri", "ng", ".", "tt", "(", "G", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "self", ".", "assert", "Equal", "(", "x", ",", "1.0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", ".", "add", "\\u", "edge", "('", "z", "','", "y", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "x", " ", "=", " ", "clusteri", "ng", ".", "tt", "(", "G", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "self", ".", "assert", "Equal", "(", "x", ",", "1.0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\t", "def", " ", "test\\u", "zero", "\\u", "outd", "egr", "ee", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", " ", "=", " ", "Di", "Graph", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", ".", "add", "\\u", "edge", "('", "x", "','", "y", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "x", " ", "=", " ", "clusteri", "ng", ".", "tt", "(", "G", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "self", ".", "assert", "Equal", "(", "x", ",", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\t", "def", " ", "test\\u", "simple", "2", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", " ", "=", " ", "Di", "Graph", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "n1", " ", "=", " ", "G", ".", "add", "\\u", "node", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "n2", " ", "=", " ", "G", ".", "add", "\\u", "node", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", ".", "add", "\\u", "edge", "\\u(", "n1", ",", "n2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "for", " ", "i", " ", "in", " ", "range", "(", "2", ",", "100", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "n", " ", "=", " ", "G", ".", "add", "\\u", "node", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "G", ".", "add", "\\u", "edge", "\\u(", "n1", ",", "n", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "\t", "G", ".", "add", "\\u", "edge", "\\u(", "n", ",", "n", "-1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "G", ".", "add", "\\u", "edge", "\\u(", "n2", ",", "9", "9", ")", "\t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " \t\t", "x", " ", "=", " ", "clusteri", "ng", ".", "tt", "(", "G", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Local", "Clustering", "Coeff", "icient", "Test", "Case_", "(_", "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_", "Local", "Clustering", "Coeff", "icient", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "test\\u", "simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "G_", "=_", "Di", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge_", "(_", "'", "x", "'_", ",_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge_", "(_", "'", "x", "'_", ",_", "'", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge_", "(_", "'", "y", "'_", ",_", "'", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "clustering_", "._", "lc", "c_", "(_", "G_", ")_", "#", ",", "nbu", "nch", "=[", "'", "x", "']", ",", "avg", "=", "Tru", "e", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "x_", "[_", "'", "x", "'_", "]_", ",_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "G_", "._", "add", "\\u", "edge_", "(_", "'", "z", "'_", ",_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "clustering_", "._", "lc", "c_", "(_", "G_", ")_", "#", ",", "nbu", "nch", "=[", "'", "x", "']", ",", "avg", "=", "Tru", "e", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "x_", "[_", "'", "x", "'_", "]_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "clustering_", "._", "ncc", "_", "(_", "G_", ")_", "#", ",", "avg", "=", "Tru", "e", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "x_", ",_", "0.333", "33333333333", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Local", "Clustering", "Coeff", "icient", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "zero", "\\u", "outd", "egr", "ee_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "G_", "=_", "Di", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge_", "(_", "'", "x", "'_", ",_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "clustering_", "._", "lc", "c_", "(_", "G_", ")_", "#", ",", "nbu", "nch", "=[", "'", "y", "']", ",", "avg", "=", "Tru", "e", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "x_", "[_", "'", "y", "'_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Local", "Clustering", "Coeff", "icient", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "simple", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "G_", "=_", "Di", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "G_", "._", "add", "\\u", "node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "G_", "._", "add", "\\u", "node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "n1_", ",_", "n2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "2_", ",_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "n_", "=_", "G_", "._", "add", "\\u", "node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "n1_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "n_", ",_", "n_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "n2_", ",_", "99_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "clustering_", "._", "lc", "c_", "(_", "G_", ")_", "\\u\\u\\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_", "Global", "Clustering", "Coeff", "icient", "Test", "Case_", "(_", "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_", "[SEP]_", "class_", "Global", "Clustering", "Coeff", "icient", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "test\\u", "simple", "\\u", "dir_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "G_", "=_", "Di", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge_", "(_", "'", "x", "'_", ",_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge_", "(_", "'", "x", "'_", ",_", "'", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge_", "(_", "'", "y", "'_", ",_", "'", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "clustering_", "._", "gcc", "_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "x_", ",_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "G_", "._", "add", "\\u", "edge_", "(_", "'", "z", "'_", ",_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "clustering_", "._", "gcc", "_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "x_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Global", "Clustering", "Coeff", "icient", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "simple", "\\u", "udi", "r_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "G_", "=_", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge_", "(_", "'", "x", "'_", ",_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge_", "(_", "'", "x", "'_", ",_", "'", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge_", "(_", "'", "y", "'_", ",_", "'", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "clustering_", "._", "gcc", "_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "x_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "G_", "._", "add", "\\u", "edge_", "(_", "'", "z", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "clustering_", "._", "gcc", "_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "x_", ",_", "3.0_", "/_", "5.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Global", "Clustering", "Coeff", "icient", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "zero", "\\u", "outd", "egr", "ee_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "G_", "=_", "Di", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge_", "(_", "'", "x", "'_", ",_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "clustering_", "._", "gcc", "_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "x_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Global", "Clustering", "Coeff", "icient", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "simple", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "G_", "=_", "Di", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "G_", "._", "add", "\\u", "node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "G_", "._", "add", "\\u", "node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "n1_", ",_", "n2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "2_", ",_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "n_", "=_", "G_", "._", "add", "\\u", "node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "n1_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "n_", ",_", "n_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "G_", "._", "add", "\\u", "edge", "\\u_", "(_", "n2_", ",_", "99_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "clustering_", "._", "gcc", "_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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/ga.py
[ { "content": "__author__ = 'Tom Schaul, [email protected]'\n\nfrom scipy import randn, zeros\nfrom scipy import random as rd, array\nfrom random import choice, random, gauss, shuffle, sample\nfrom numpy import ndarray\n\nfrom pybrain.optimization.populationbased.evolution import Evolution\nfrom pybrain.optimization.optimizer import ContinuousOptimizer\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class GA(ContinuousOptimizer, Evolution):\n \"\"\" Standard Genetic Algorithm. \"\"\"\n\n #: selection scheme\n tournament = False\n tournamentSize = 2\n\n #: selection proportion\n topProportion = 0.2\n\n elitism = False\n eliteProportion = 0.5\n _eliteSize = None # override with an exact number\n\n #: mutation probability\n mutationProb = 0.1\n mutationStdDev = 0.5\n initRangeScaling = 10.\n\n initialPopulation = None\n \n mustMaximize = True\n\n '''added by JPQ'''\n # --- \n\n \n \n ''' added by JPQ in replacement of crossover and mutated ''' \n \n \n\n # ---\n \n\n\n", "metadata": "root.GA", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def initBoundaries(self):\n assert len(self.xBound) == self.numParameters\n self.mins = array([min_ for min_, max_ in self.xBound])\n self.maxs = array([max_ for min_, max_ in self.xBound])", "metadata": "root.GA.initBoundaries", "header": "['class', 'GA', '(', 'ContinuousOptimizer', ',', 'Evolution', ')', ':', '___EOS___']", "index": 35 }, { "content": " def initPopulation(self):\n '''added by JPQ '''\n if self.xBound is not None:\n self.initBoundaries()\n # ---\n if self.initialPopulation is not None:\n self.currentpop = self.initialPopulation\n else:\n self.currentpop = [self._initEvaluable]\n for _ in range(self.populationSize-1):\n '''added by JPQ '''\n if self.xBound is None:\n # ---\n self.currentpop.append(self._initEvaluable+randn(self.numParameters)\n *self.mutationStdDev*self.initRangeScaling)\n '''added by JPQ '''\n else:\n position = rd.random(self.numParameters)\n position *= (self.maxs-self.mins)\n position += self.mins\n self.currentpop.append(position)\n # ---", "metadata": "root.GA.initPopulation", "header": "['class', 'GA', '(', 'ContinuousOptimizer', ',', 'Evolution', ')', ':', '___EOS___']", "index": 40 }, { "content": " def crossOverOld(self, parents, nbChildren):\n \"\"\" generate a number of children by doing 1-point cross-over \"\"\"\n xdim = self.numParameters\n children = []\n for _ in range(nbChildren):\n p1 = choice(parents)\n if xdim < 2:\n children.append(p1)\n else:\n p2 = choice(parents)\n point = choice(list(range(xdim-1)))\n point += 1\n res = zeros(xdim)\n res[:point] = p1[:point]\n res[point:] = p2[point:]\n children.append(res)\n return children", "metadata": "root.GA.crossOverOld", "header": "['class', 'GA', '(', 'ContinuousOptimizer', ',', 'Evolution', ')', ':', '___EOS___']", "index": 63 }, { "content": " def mutatedOld(self, indiv):\n \"\"\" mutate some genes of the given individual \"\"\"\n res = indiv.copy()\n for i in range(self.numParameters):\n if random() < self.mutationProb:\n res[i] = indiv[i] + gauss(0, self.mutationStdDev)\n return res", "metadata": "root.GA.mutatedOld", "header": "['class', 'GA', '(', 'ContinuousOptimizer', ',', 'Evolution', ')', ':', '___EOS___']", "index": 81 }, { "content": " def crossOver(self, parents, nbChildren):\n \"\"\" generate a number of children by doing 1-point cross-over \"\"\"\n \"\"\" change as the <choice> return quite often the same p1 and even\n several time p2 was return the same than p1 \"\"\"\n xdim = self.numParameters\n shuffle(parents)\n children = []\n for i in range(len(parents)//2):\n p1 = parents[i]\n p2 = parents[i+(len(parents)//2)]\n if xdim < 2:\n children.append(p1)\n children.append(p2)\n else:\n point = choice(list(range(xdim-1)))\n point += 1\n res = zeros(xdim)\n res[:point] = p1[:point]\n res[point:] = p2[point:]\n children.append(res)\n res = zeros(xdim)\n res[:point] = p2[:point]\n res[point:] = p1[point:]\n children.append(res)\n shuffle(children)\n if len(children) > nbChildren:\n children = children[:nbChildren] \n else:\n while (len(children) < nbChildren):\n children += sample(children,1)\n return children", "metadata": "root.GA.crossOver", "header": "['class', 'GA', '(', 'ContinuousOptimizer', ',', 'Evolution', ')', ':', '___EOS___']", "index": 90 }, { "content": " def childexist(self,indiv,pop):\n if isinstance(pop,list):\n for i in range(len(pop)):\n if all((abs(indiv[k] - pop[i][k])/(self.maxs[k]-self.mins[k]))\n < 1.e-7 for k in range(self.numParameters)):\n return True\n return False", "metadata": "root.GA.childexist", "header": "['class', 'GA', '(', 'ContinuousOptimizer', ',', 'Evolution', ')', ':', '___EOS___']", "index": 122 }, { "content": " def mutated(self, indiv):\n \"\"\" mutate some genes of the given individual \"\"\"\n res = indiv.copy()\n #to avoid having a child identical to one of the currentpopulation'''\n for i in range(self.numParameters):\n if random() < self.mutationProb:\n if self.xBound is None:\n res[i] = indiv[i] + gauss(0, self.mutationStdDev)\n else:\n res[i] = max(min(indiv[i] + gauss(0, self.mutationStdDev),self.maxs[i]),\n self.mins[i])\n return res", "metadata": "root.GA.mutated", "header": "['class', 'GA', '(', 'ContinuousOptimizer', ',', 'Evolution', ')', ':', '___EOS___']", "index": 130 }, { "content": " def old_jpq_mutated(self, indiv, pop):\n \"\"\" mutate some genes of the given individual \"\"\"\n res = indiv.copy()\n #to avoid having a child identical to one of the currentpopulation'''\n in_pop = self.childexist(indiv,pop)\n for i in range(self.numParameters):\n if random() < self.mutationProb:\n res[i] = max(min(indiv[i] + gauss(0, self.mutationStdDev),self.maxs[i]),\n self.mins[i])\n \n if random() < self.mutationProb or in_pop:\n if self.xBound is None:\n res[i] = indiv[i] + gauss(0, self.mutationStdDev)\n else:\n if in_pop:\n cmin = abs(indiv[i] - self.mins[i])/(self.maxs[i]-self.mins[i])\n cmax = abs(indiv[i] - self.maxs[i])/(self.maxs[i]-self.mins[i])\n if cmin < 1.e-7 or cmax < 1.e-7:\n res[i] = self.mins[i] + random()*random()*(self.maxs[i]-self.mins[i])\n else:\n res[i] = max(min(indiv[i] + gauss(0, self.mutationStdDev),self.maxs[i]),\n self.mins[i])\n else:\n res[i] = max(min(indiv[i] + gauss(0, self.mutationStdDev),self.maxs[i]),\n self.mins[i])\n\n return res", "metadata": "root.GA.old_jpq_mutated", "header": "['class', 'GA', '(', 'ContinuousOptimizer', ',', 'Evolution', ')', ':', '___EOS___']", "index": 143 }, { "content": " @property\n def selectionSize(self):\n \"\"\" the number of parents selected from the current population \"\"\"\n return int(self.populationSize * self.topProportion)", "metadata": "root.GA.selectionSize", "header": "['class', 'GA', '(', 'ContinuousOptimizer', ',', 'Evolution', ')', ':', '___EOS___']", "index": 172 }, { "content": " @property\n def eliteSize(self):\n if self.elitism:\n if self._eliteSize != None:\n return self._eliteSize\n else:\n return int(self.populationSize * self.eliteProportion)\n else:\n return 0", "metadata": "root.GA.eliteSize", "header": "['class', 'GA', '(', 'ContinuousOptimizer', ',', 'Evolution', ')', ':', '___EOS___']", "index": 177 }, { "content": " def select(self):\n \"\"\" select some of the individuals of the population, taking into account their fitnesses\n\n :return: list of selected parents \"\"\"\n if not self.tournament:\n tmp = list(zip(self.fitnesses, self.currentpop))\n tmp.sort(key = lambda x: x[0])\n tmp2 = list(reversed(tmp))[:self.selectionSize]\n return [x[1] for x in tmp2]\n else:\n # TODO: tournament selection\n raise NotImplementedError()", "metadata": "root.GA.select", "header": "['class', 'GA', '(', 'ContinuousOptimizer', ',', 'Evolution', ')', ':', '___EOS___']", "index": 187 }, { "content": " def produceOffspring(self):\n \"\"\" produce offspring by selection, mutation and crossover. \"\"\"\n parents = self.select()\n es = min(self.eliteSize, self.selectionSize)\n self.currentpop = parents[:es]\n '''Modified by JPQ '''\n nbchildren = self.populationSize - es\n if self.populationSize - es <= 0:\n nbchildren = len(parents)\n for child in self.crossOver(parents, nbchildren ):\n self.currentpop.append(self.mutated(child))\n # ---", "metadata": "root.GA.produceOffspring", "header": "['class', 'GA', '(', 'ContinuousOptimizer', ',', 'Evolution', ')', ':', '___EOS___']", "index": 200 } ]
[ { "span": "from numpy import ndarray", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 25 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "Tom", " ", "Sch", "aul", ",", " ", "tom", "@", "ids", "ia", ".", "ch", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "scipy_", "import_", "randn_", ",_", "zeros_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "import_", "random_", "as_", "rd_", ",_", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "random_", "import_", "choice_", ",_", "random_", ",_", "gauss_", ",_", "shuffle_", ",_", "sample_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "import_", "ndarray_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyb", "rain_", "._", "optimization", "_", "._", "popul", "ation", "based", "_", "._", "evolution", "_", "import_", "Evol", "uti", "on_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyb", "rain_", "._", "optimization", "_", "._", "optimizer_", "import_", "Continu", "ous", "Optimizer_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "GA", "_", "(_", "Continu", "ous", "Optimizer_", ",_", "Evol", "uti", "on_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Standard", " ", "Gene", "tic", " ", "Algorit", "hm", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "selection", " ", "scheme_", "\\u\\u\\uNL\\u\\u\\u_", "tournament", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tournament", "Size_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "selection", " ", "proportion_", "\\u\\u\\uNL\\u\\u\\u_", "top", "Prop", "ortion", "_", "=_", "0.2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "elit", "ism", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elit", "e", "Prop", "ortion", "_", "=_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "elit", "e", "Size_", "=_", "None_", "#", " ", "override", " ", "with", " ", "an", " ", "exact", " ", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "mutat", "ion", " ", "probability_", "\\u\\u\\uNL\\u\\u\\u_", "mutat", "ion", "Prob_", "=_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mutat", "ion", "Std", "Dev_", "=_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "Range", "Sca", "ling_", "=_", "10._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "initial", "Population_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "must", "Maxim", "ize_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "adde", "d", " ", "by", " ", "JP", "Q", "'''_", "\\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\\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_", "'''", " ", "adde", "d", " ", "by", " ", "JP", "Q", " ", "in", " ", "replace", "ment", " ", "of", " ", "crossover", " ", "and", " ", "mutate", "d", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "GA", "_", "(_", "Continu", "ous", "Optimizer_", ",_", "Evol", "uti", "on_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "init", "Boundar", "ies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "self_", "._", "x", "Bound_", ")_", "==_", "self_", "._", "num", "Parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mins_", "=_", "array_", "(_", "[_", "min", "\\u_", "for_", "min", "\\u_", ",_", "max", "\\u_", "in_", "self_", "._", "x", "Bound_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "maxs", "_", "=_", "array_", "(_", "[_", "max", "\\u_", "for_", "min", "\\u_", ",_", "max", "\\u_", "in_", "self_", "._", "x", "Bound_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GA", "_", "(_", "Continu", "ous", "Optimizer_", ",_", "Evol", "uti", "on_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "Population_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "adde", "d", " ", "by", " ", "JP", "Q", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "x", "Bound_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "init", "Boundar", "ies_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "initial", "Population_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "current", "pop_", "=_", "self_", "._", "initial", "Population_", "\\u\\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_", "._", "current", "pop_", "=_", "[_", "self_", "._", "\\u", "init", "Eval", "uab", "le_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "self_", "._", "popul", "ation", "Size_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "adde", "d", " ", "by", " ", "JP", "Q", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "x", "Bound_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "current", "pop_", "._", "append_", "(_", "self_", "._", "\\u", "init", "Eval", "uab", "le_", "+_", "randn_", "(_", "self_", "._", "num", "Parameters_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "self_", "._", "mutat", "ion", "Std", "Dev_", "*_", "self_", "._", "init", "Range", "Sca", "ling_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "adde", "d", " ", "by", " ", "JP", "Q", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "position_", "=_", "rd_", "._", "random_", "(_", "self_", "._", "num", "Parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "position_", "*=_", "(_", "self_", "._", "maxs", "_", "-_", "self_", "._", "mins_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "position_", "+=_", "self_", "._", "mins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "current", "pop_", "._", "append_", "(_", "position_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "GA", "_", "(_", "Continu", "ous", "Optimizer_", ",_", "Evol", "uti", "on_", ")_", ":_", "\\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_", "cross", "Over", "Old", "_", "(_", "self_", ",_", "parents_", ",_", "nb", "Children_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "generat", "e", " ", "a", " ", "number", " ", "of", " ", "child", "ren", " ", "by", " ", "doi", "ng", " ", "1", "-", "point", " ", "cross", "-", "over", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xdi", "m_", "=_", "self_", "._", "num", "Parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "children_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "nb", "Children_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p1_", "=_", "choice_", "(_", "parents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xdi", "m_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "children_", "._", "append_", "(_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p2_", "=_", "choice_", "(_", "parents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point_", "=_", "choice_", "(_", "list_", "(_", "range_", "(_", "xdi", "m_", "-_", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "zeros_", "(_", "xdi", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", ":_", "point_", "]_", "=_", "p1_", "[_", ":_", "point_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "point_", ":_", "]_", "=_", "p2_", "[_", "point_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "children_", "._", "append_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "children_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GA", "_", "(_", "Continu", "ous", "Optimizer_", ",_", "Evol", "uti", "on_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mutate", "d", "Old", "_", "(_", "self_", ",_", "indiv", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "mutate", " ", "some", " ", "gene", "s", " ", "of", " ", "the", " ", "give", "n", " ", "individual", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "indiv", "_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "self_", "._", "num", "Parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "random_", "(_", ")_", "<_", "self_", "._", "mutat", "ion", "Prob_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "[_", "i_", "]_", "=_", "indiv", "_", "[_", "i_", "]_", "+_", "gauss_", "(_", "0_", ",_", "self_", "._", "mutat", "ion", "Std", "Dev_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GA", "_", "(_", "Continu", "ous", "Optimizer_", ",_", "Evol", "uti", "on_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cross", "Over", "_", "(_", "self_", ",_", "parents_", ",_", "nb", "Children_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "generat", "e", " ", "a", " ", "number", " ", "of", " ", "child", "ren", " ", "by", " ", "doi", "ng", " ", "1", "-", "point", " ", "cross", "-", "over", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", " ", "change", " ", "as", " ", "the", " ", "<", "choice", ">", " ", "return", " ", "quite", " ", "oft", "en", " ", "the", " ", "same", " ", "p1", " ", "and", " ", "even", "\\", "10", ";", " ", " ", " ", " ", "sever", "al", " ", "time", " ", "p2", " ", "was", " ", "return", " ", "the", " ", "same", " ", "than", " ", "p1", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xdi", "m_", "=_", "self_", "._", "num", "Parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shuffle_", "(_", "parents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "children_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "parents_", ")_", "//_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p1_", "=_", "parents_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "parents_", "[_", "i_", "+_", "(_", "len_", "(_", "parents_", ")_", "//_", "2_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xdi", "m_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "children_", "._", "append_", "(_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "children_", "._", "append_", "(_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "point_", "=_", "choice_", "(_", "list_", "(_", "range_", "(_", "xdi", "m_", "-_", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "zeros_", "(_", "xdi", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", ":_", "point_", "]_", "=_", "p1_", "[_", ":_", "point_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "point_", ":_", "]_", "=_", "p2_", "[_", "point_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "children_", "._", "append_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "zeros_", "(_", "xdi", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", ":_", "point_", "]_", "=_", "p2_", "[_", ":_", "point_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "point_", ":_", "]_", "=_", "p1_", "[_", "point_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "children_", "._", "append_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shuffle_", "(_", "children_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "children_", ")_", ">_", "nb", "Children_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "children_", "=_", "children_", "[_", ":_", "nb", "Children_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "(_", "len_", "(_", "children_", ")_", "<_", "nb", "Children_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "children_", "+=_", "sample_", "(_", "children_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "children_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GA", "_", "(_", "Continu", "ous", "Optimizer_", ",_", "Evol", "uti", "on_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "child", "exist_", "(_", "self_", ",_", "indiv", "_", ",_", "pop_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "pop_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "pop_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "all_", "(_", "(_", "abs_", "(_", "indiv", "_", "[_", "k_", "]_", "-_", "pop_", "[_", "i_", "]_", "[_", "k_", "]_", ")_", "/_", "(_", "self_", "._", "maxs", "_", "[_", "k_", "]_", "-_", "self_", "._", "mins_", "[_", "k_", "]_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "<_", "1.e", "-", "7_", "for_", "k_", "in_", "range_", "(_", "self_", "._", "num", "Parameters_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GA", "_", "(_", "Continu", "ous", "Optimizer_", ",_", "Evol", "uti", "on_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mutate", "d_", "(_", "self_", ",_", "indiv", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "mutate", " ", "some", " ", "gene", "s", " ", "of", " ", "the", " ", "give", "n", " ", "individual", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "indiv", "_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "to", " ", "avoid", " ", "hav", "ing", " ", "a", " ", "child", " ", "identi", "cal", " ", "to", " ", "one", " ", "of", " ", "the", " ", "current", "popul", "ation", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "self_", "._", "num", "Parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "random_", "(_", ")_", "<_", "self_", "._", "mutat", "ion", "Prob_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "x", "Bound_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "res_", "[_", "i_", "]_", "=_", "indiv", "_", "[_", "i_", "]_", "+_", "gauss_", "(_", "0_", ",_", "self_", "._", "mutat", "ion", "Std", "Dev_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "res_", "[_", "i_", "]_", "=_", "max_", "(_", "min_", "(_", "indiv", "_", "[_", "i_", "]_", "+_", "gauss_", "(_", "0_", ",_", "self_", "._", "mutat", "ion", "Std", "Dev_", ")_", ",_", "self_", "._", "maxs", "_", "[_", "i_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mins_", "[_", "i_", "]_", ")_", "\\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_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GA", "_", "(_", "Continu", "ous", "Optimizer_", ",_", "Evol", "uti", "on_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "old", "\\u", "jp", "q", "\\u", "mutate", "d_", "(_", "self_", ",_", "indiv", "_", ",_", "pop_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "mutate", " ", "some", " ", "gene", "s", " ", "of", " ", "the", " ", "give", "n", " ", "individual", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "indiv", "_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "to", " ", "avoid", " ", "hav", "ing", " ", "a", " ", "child", " ", "identi", "cal", " ", "to", " ", "one", " ", "of", " ", "the", " ", "current", "popul", "ation", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "pop_", "=_", "self_", "._", "child", "exist_", "(_", "indiv", "_", ",_", "pop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "self_", "._", "num", "Parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "random_", "(_", ")_", "<_", "self_", "._", "mutat", "ion", "Prob_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "[_", "i_", "]_", "=_", "max_", "(_", "min_", "(_", "indiv", "_", "[_", "i_", "]_", "+_", "gauss_", "(_", "0_", ",_", "self_", "._", "mutat", "ion", "Std", "Dev_", ")_", ",_", "self_", "._", "maxs", "_", "[_", "i_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mins_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "random_", "(_", ")_", "<_", "self_", "._", "mutat", "ion", "Prob_", "or_", "in", "\\u", "pop_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "x", "Bound_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "res_", "[_", "i_", "]_", "=_", "indiv", "_", "[_", "i_", "]_", "+_", "gauss_", "(_", "0_", ",_", "self_", "._", "mutat", "ion", "Std", "Dev_", ")_", "\\u\\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_", "in", "\\u", "pop_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cmi", "n_", "=_", "abs_", "(_", "indiv", "_", "[_", "i_", "]_", "-_", "self_", "._", "mins_", "[_", "i_", "]_", ")_", "/_", "(_", "self_", "._", "maxs", "_", "[_", "i_", "]_", "-_", "self_", "._", "mins_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cma", "x_", "=_", "abs_", "(_", "indiv", "_", "[_", "i_", "]_", "-_", "self_", "._", "maxs", "_", "[_", "i_", "]_", ")_", "/_", "(_", "self_", "._", "maxs", "_", "[_", "i_", "]_", "-_", "self_", "._", "mins_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cmi", "n_", "<_", "1.e", "-", "7_", "or_", "cma", "x_", "<_", "1.e", "-", "7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "res_", "[_", "i_", "]_", "=_", "self_", "._", "mins_", "[_", "i_", "]_", "+_", "random_", "(_", ")_", "*_", "random_", "(_", ")_", "*_", "(_", "self_", "._", "maxs", "_", "[_", "i_", "]_", "-_", "self_", "._", "mins_", "[_", "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 ", " ", " _", "res_", "[_", "i_", "]_", "=_", "max_", "(_", "min_", "(_", "indiv", "_", "[_", "i_", "]_", "+_", "gauss_", "(_", "0_", ",_", "self_", "._", "mutat", "ion", "Std", "Dev_", ")_", ",_", "self_", "._", "maxs", "_", "[_", "i_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mins_", "[_", "i_", "]_", ")_", "\\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 ", " ", " _", "res_", "[_", "i_", "]_", "=_", "max_", "(_", "min_", "(_", "indiv", "_", "[_", "i_", "]_", "+_", "gauss_", "(_", "0_", ",_", "self_", "._", "mutat", "ion", "Std", "Dev_", ")_", ",_", "self_", "._", "maxs", "_", "[_", "i_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mins_", "[_", "i_", "]_", ")_", "\\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_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GA", "_", "(_", "Continu", "ous", "Optimizer_", ",_", "Evol", "uti", "on_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "selection", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "the", " ", "number", " ", "of", " ", "parents", " ", "selecte", "d", " ", "from", " ", "the", " ", "current", " ", "popul", "ation", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "int_", "(_", "self_", "._", "popul", "ation", "Size_", "*_", "self_", "._", "top", "Prop", "ortion", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GA", "_", "(_", "Continu", "ous", "Optimizer_", ",_", "Evol", "uti", "on_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "elit", "e", "Size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "elit", "ism", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "elit", "e", "Size_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "elit", "e", "Size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "self_", "._", "popul", "ation", "Size_", "*_", "self_", "._", "elit", "e", "Prop", "ortion", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GA", "_", "(_", "Continu", "ous", "Optimizer_", ",_", "Evol", "uti", "on_", ")_", ":_", "\\u\\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_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "select", " ", "some", " ", "of", " ", "the", " ", "individual", "s", " ", "of", " ", "the", " ", "popul", "ation", ",", " ", "tak", "ing", " ", "int", "o", " ", "account", " ", "thei", "r", " ", "fitness", "es", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "list", " ", "of", " ", "selecte", "d", " ", "parents", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "tournament", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp_", "=_", "list_", "(_", "zip_", "(_", "self_", "._", "fitness", "es_", ",_", "self_", "._", "current", "pop_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp2_", "=_", "list_", "(_", "reversed_", "(_", "tmp_", ")_", ")_", "[_", ":_", "self_", "._", "selection", "Size_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "x_", "[_", "1_", "]_", "for_", "x_", "in_", "tmp2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "tournament", " ", "selection_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GA", "_", "(_", "Continu", "ous", "Optimizer_", ",_", "Evol", "uti", "on_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "produce", "Off", "spring", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "produce", " ", "offsp", "ring", " ", "by", " ", "selection", ",", " ", "mutat", "ion", " ", "and", " ", "crossover", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parents_", "=_", "self_", "._", "select_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es_", "=_", "min_", "(_", "self_", "._", "elit", "e", "Size_", ",_", "self_", "._", "selection", "Size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "current", "pop_", "=_", "parents_", "[_", ":_", "es_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "Modifie", "d", " ", "by", " ", "JP", "Q", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nbc", "hild", "ren", "_", "=_", "self_", "._", "popul", "ation", "Size_", "-_", "es_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "popul", "ation", "Size_", "-_", "es_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nbc", "hild", "ren", "_", "=_", "len_", "(_", "parents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "child_", "in_", "self_", "._", "cross", "Over", "_", "(_", "parents_", ",_", "nbc", "hild", "ren", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "current", "pop_", "._", "append_", "(_", "self_", "._", "mutate", "d_", "(_", "child_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "---", "_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
coreemu/core/daemon/core/emane/universal.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'''\nuniversal.py: EMANE Universal PHY model for CORE. Enumerates configuration items\nused for the Universal PHY.\n'''\n\nimport sys\nimport string\ntry:\n from emanesh.events import EventService\nexcept:\n pass\nfrom core.api import coreapi\nfrom core.constants import *\nfrom emane import Emane, EmaneModel\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[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", ";", "universal", ".", "py", ":", " ", "EMA", "NE", " ", "Universal", " ", "PHY", " ", "model", " ", "for", " ", "CORE", ".", " ", "Enumerate", "s", " ", "configura", "tion", " ", "items", "\\", "10", ";", "used", " ", "for", " ", "the", " ", "Universal", " ", "PHY", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "core_", "._", "api_", "import_", "core", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "constants_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eman", "e_", "import_", "Ema", "ne_", ",_", "Ema", "ne", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 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, 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 ]
Except block handles 'BaseException'
CollabQ/CollabQ/login/views.py
[ { "content": "@decorator.cache_never\ndef login_login(request):\n redirect_to = request.REQUEST.get('redirect_to', '/')\n redirect_to = clean.redirect_to(redirect_to)\n \n if request.POST:\n try:\n login = request.POST.get('log', None)\n password = request.POST.get('pwd', None)\n rememberme = request.POST.get('rememberme', None)\n\n # TODO validate\n\n current_user = user.lookup_user_by_login(login, password)\n if current_user:\n if redirect_to == '/':\n redirect_to = current_user.url('/overview')\n\n # Attempt to do some cleanup on the user if necessary\n api.user_cleanup(api.ROOT, current_user.nick)\n\n \n # if we aren't hosted or aren't ssl just set the cookie and go home\n if (not settings.HOSTED_DOMAIN_ENABLED \n or not settings.SSL_LOGIN_ENABLED):\n response = http.HttpResponseRedirect(redirect_to)\n response = user.set_user_cookie(response, current_user, rememberme)\n return response\n \n # otherwise, we're going to have to redirect to set the cookie on\n # the proper domain\n sso_token = util.generate_uuid()\n\n cache.set('sso/%s' % sso_token, (current_user.nick, rememberme), timeout=10)\n sso_url = 'http://%s/login/noreally' % (settings.DOMAIN)\n sso_url = util.qsa(\n sso_url, {'redirect_to': redirect_to, 'sso_token': sso_token})\n return http.HttpResponseRedirect(sso_url)\n else:\n raise exception.ValidationError(\"Invalid username or password\")\n except:\n exception.handle_exception(request)\n view =user.get_user_from_cookie_or_legacy_auth(request)\n area=\"login\"\n if view:\n if redirect_to == '/':\n redirect_to = request.user.url('/overview')\n return http.HttpResponseRedirect(redirect_to)\n \n c = template.RequestContext(request, locals()) \n t = loader.get_template('login/templates/login.html')\n return http.HttpResponse(t.render(c))", "metadata": "root.login_login", "header": "['module', '___EOS___']", "index": 32 } ]
[ { "span": "except:", "start_line": 72, "start_column": 4, "end_line": 72, "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_", "@_", "decorator_", "._", "cache", "\\u", "neve", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "login", "\\u", "login_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "redirec", "t", "\\u", "to_", "=_", "request_", "._", "REQUEST_", "._", "get_", "(_", "'", "redirec", "t", "\\u", "to", "'_", ",_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "t", "\\u", "to_", "=_", "clean_", "._", "redirec", "t", "\\u", "to_", "(_", "redirec", "t", "\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "POST_", ":_", "\\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 ", " _", "login_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "log", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "pwd", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remember", "me_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "remember", "me", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "validate_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "user_", "=_", "user_", "._", "look", "up", "\\u", "user", "\\u", "by", "\\u", "login_", "(_", "login_", ",_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "redirec", "t", "\\u", "to_", "==_", "'/'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "redirec", "t", "\\u", "to_", "=_", "current", "\\u", "user_", "._", "url_", "(_", "'/", "over", "view", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Atte", "mpt", " ", "to", " ", "do", " ", "some", " ", "clean", "up", " ", "on", " ", "the", " ", "user", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "api_", "._", "user", "\\u", "cleanup_", "(_", "api_", "._", "ROOT_", ",_", "current", "\\u", "user_", "._", "nick_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "are", "n", "'", "t", " ", "hoste", "d", " ", "or", " ", "are", "n", "'", "t", " ", "ssl", " ", "just", " ", "set", " ", "the", " ", "cookie", " ", "and", " ", "go", " ", "home_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "not_", "settings_", "._", "HOST", "ED", "\\u", "DOM", "AIN", "\\u", "ENABLED_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "not_", "settings_", "._", "SS", "L", "\\u", "LOGIN", "\\u", "ENABLED_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "http_", "._", "Http", "Respons", "e", "Redirect_", "(_", "redirec", "t", "\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "user_", "._", "set\\u", "user", "\\u", "cookie_", "(_", "response_", ",_", "current", "\\u", "user_", ",_", "remember", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", "wis", "e", ",", " ", "we", "'", "re", " ", "goi", "ng", " ", "to", " ", "have", " ", "to", " ", "redirec", "t", " ", "to", " ", "set", " ", "the", " ", "cookie", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "proper", " ", "domain_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sso", "\\u", "token_", "=_", "util_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "._", "set_", "(_", "'", "sso", "/", "%", "s", "'_", "%_", "sso", "\\u", "token_", ",_", "(_", "current", "\\u", "user_", "._", "nick_", ",_", "remember", "me_", ")_", ",_", "timeout_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sso", "\\u", "url_", "=_", "'", "http", "://", "%", "s", "/", "login", "/", "nore", "ally", "'_", "%_", "(_", "settings_", "._", "DOMAIN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sso", "\\u", "url_", "=_", "util_", "._", "qs", "a_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "sso", "\\u", "url_", ",_", "{_", "'", "redirec", "t", "\\u", "to", "'_", ":_", "redirec", "t", "\\u", "to_", ",_", "'", "sso", "\\u", "token", "'_", ":_", "sso", "\\u", "token_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "http_", "._", "Http", "Respons", "e", "Redirect_", "(_", "sso", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Validat", "ion", "Error_", "(_", "\"", "Inva", "lid", " ", "user", "name", " ", "or", " ", "password", "\"_", ")_", "\\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 ", " _", "exception_", "._", "handle", "\\u", "exception_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "view_", "=_", "user_", "._", "get", "\\u", "user", "\\u", "from", "\\u", "cookie", "\\u", "or", "\\u", "lega", "cy", "\\u", "auth_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "area_", "=_", "\"", "login", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "view_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "redirec", "t", "\\u", "to_", "==_", "'/'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "redirec", "t", "\\u", "to_", "=_", "request_", "._", "user_", "._", "url_", "(_", "'/", "over", "view", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "http_", "._", "Http", "Respons", "e", "Redirect_", "(_", "redirec", "t", "\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "template_", "._", "Request", "Context_", "(_", "request_", ",_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "loader_", "._", "get", "\\u", "template_", "(_", "'", "login", "/", "template", "s", "/", "login", ".", "html",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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 ]
Except block handles 'BaseException'
ProgVal/Limnoria/src/ircutils.py
[ { "content": " def __eq__(self, s):\n try:\n return toLower(s) == self.lowered\n except:\n return False", "metadata": "root.IrcString.__eq__", "header": "['class', 'IrcString', '(', 'str', ')', ':', '___EOS___']", "index": 665 } ]
[ { "span": "except:", "start_line": 668, "start_column": 8, "end_line": 668, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Ir", "c", "String_", "(_", "str_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "s_", ")_", ":_", "\\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_", "to", "Lower", "_", "(_", "s_", ")_", "==_", "self_", "._", "lower", "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_" ]
[ 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, 1, 2, 2, 2, 2, 2, 2 ]
Insecure temporary file
babble/babble/include/jython/Lib/logging/config.py
[ { "content": "def listen(port=DEFAULT_LOGGING_CONFIG_PORT):\n \"\"\"\n Start up a socket server on the specified port, and listen for new\n configurations.\n\n These will be sent as a file suitable for processing by fileConfig().\n Returns a Thread object on which you can call start() to start the server,\n and which you can join() when appropriate. To stop the server, call\n stopListening().\n \"\"\"\n if not thread:\n raise NotImplementedError, \"listen() needs threading to work\"\n\n class ConfigStreamHandler(StreamRequestHandler):\n \"\"\"\n Handler for a logging configuration request.\n\n It expects a completely new logging configuration and uses fileConfig\n to install it.\n \"\"\"\n def handle(self):\n \"\"\"\n Handle a request.\n\n Each request is expected to be a 4-byte length, packed using\n struct.pack(\">L\", n), followed by the config file.\n Uses fileConfig() to do the grunt work.\n \"\"\"\n import tempfile\n try:\n conn = self.connection\n chunk = conn.recv(4)\n if len(chunk) == 4:\n slen = struct.unpack(\">L\", chunk)[0]\n chunk = self.connection.recv(slen)\n while len(chunk) < slen:\n chunk = chunk + conn.recv(slen - len(chunk))\n #Apply new configuration. We'd like to be able to\n #create a StringIO and pass that in, but unfortunately\n #1.5.2 ConfigParser does not support reading file\n #objects, only actual files. So we create a temporary\n #file and remove it later.\n file = tempfile.mktemp(\".ini\")\n f = open(file, \"w\")\n f.write(chunk)\n f.close()\n try:\n fileConfig(file)\n except (KeyboardInterrupt, SystemExit):\n raise\n except:\n traceback.print_exc()\n os.remove(file)\n except socket.error, e:\n if type(e.args) != types.TupleType:\n raise\n else:\n errcode = e.args[0]\n if errcode != RESET_ERROR:\n raise\n\n class ConfigSocketReceiver(ThreadingTCPServer):\n \"\"\"\n A simple TCP socket-based logging config receiver.\n \"\"\"\n\n allow_reuse_address = 1\n\n def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT,\n handler=None):\n ThreadingTCPServer.__init__(self, (host, port), handler)\n logging._acquireLock()\n self.abort = 0\n logging._releaseLock()\n self.timeout = 1\n\n def serve_until_stopped(self):\n import select\n abort = 0\n while not abort:\n rd, wr, ex = select.select([self.socket.fileno()],\n [], [],\n self.timeout)\n if rd:\n self.handle_request()\n logging._acquireLock()\n abort = self.abort\n logging._releaseLock()\n\n def serve(rcvr, hdlr, port):\n server = rcvr(port=port, handler=hdlr)\n global _listener\n logging._acquireLock()\n _listener = server\n logging._releaseLock()\n server.serve_until_stopped()\n\n return threading.Thread(target=serve,\n args=(ConfigSocketReceiver,\n ConfigStreamHandler, port))", "metadata": "root.listen", "header": "['module', '___EOS___']", "index": 237 } ]
[ { "span": "tempfile.mktemp(\".ini\")", "start_line": 279, "start_column": 27, "end_line": 279, "end_column": 50 } ]
[]
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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "listen_", "(_", "port_", "=_", "DEF", "AUL", "T", "\\u", "LOGGING", "\\u", "CONFIG", "\\u", "PORT_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Start", " ", "up", " ", "a", " ", "socket", " ", "server", " ", "on", " ", "the", " ", "specified", " ", "port", ",", " ", "and", " ", "listen", " ", "for", " ", "new", "\\", "10", ";", " ", " ", " ", " ", "configura", "tion", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", "se", " ", "will", " ", "be", " ", "sent", " ", "as", " ", "a", " ", "file", " ", "suit", "able", " ", "for", " ", "process", "ing", " ", "by", " ", "file", "Config", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "Thread", " ", "object", " ", "on", " ", "whi", "ch", " ", "you", " ", "can", " ", "call", " ", "start", "()", " ", "to", " ", "start", " ", "the", " ", "server", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "whi", "ch", " ", "you", " ", "can", " ", "join", "()", " ", "whe", "n", " ", "appropr", "iate", ".", " ", "To", " ", "stop", " ", "the", " ", "server", ",", " ", "call", "\\", "10", ";", " ", " ", " ", " ", "stop", "Listen", "ing", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "thread_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", ",_", "\"", "listen", "()", " ", "need", "s", " ", "thread", "ing", " ", "to", " ", "work", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Config", "Stream", "Handler_", "(_", "Stream", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Handle", "r", " ", "for", " ", "a", " ", "logg", "ing", " ", "configura", "tion", " ", "request", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "expect", "s", " ", "a", " ", "complete", "ly", " ", "new", " ", "logg", "ing", " ", "configura", "tion", " ", "and", " ", "use", "s", " ", "file", "Config", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "install", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "handle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Handle", " ", "a", " ", "request", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ea", "ch", " ", "request", " ", "is", " ", "expected", " ", "to", " ", "be", " ", "a", " ", "4", "-", "byte", " ", "length", ",", " ", "pack", "ed", " ", "usi", "ng", "\\", "10", ";", " ", " ", " ", " ", "struct", ".", "pack", "(\"", ">", "L", "\",", " ", "n", "),", " ", "followe", "d", " ", "by", " ", "the", " ", "config", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "es", " ", "file", "Config", "()", " ", "to", " ", "do", " ", "the", " ", "gru", "nt", " ", "work", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "self_", "._", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk_", "=_", "conn_", "._", "recv_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "chunk_", ")_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sle", "n_", "=_", "struct_", "._", "unpack_", "(_", "\">", "L", "\"_", ",_", "chunk_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk_", "=_", "self_", "._", "connection_", "._", "recv_", "(_", "sle", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "chunk_", ")_", "<_", "sle", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "chunk_", "=_", "chunk_", "+_", "conn_", "._", "recv_", "(_", "sle", "n_", "-_", "len_", "(_", "chunk_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Apply", " ", "new", " ", "configura", "tion", ".", " ", "We", "'", "d", " ", "like", " ", "to", " ", "be", " ", "able", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", "create", " ", "a", " ", "String", "IO", " ", "and", " ", "pass", " ", "tha", "t", " ", "in", ",", " ", "but", " ", "unfo", "rtu", "nat", "el", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", "1.5", ".2", " ", "Config", "Parser", " ", "doe", "s", " ", "not", " ", "support", " ", "readi", "ng", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", "object", "s", ",", " ", "only", " ", "actual", " ", "files", ".", " ", "So", " ", "we", " ", "create", " ", "a", " ", "temporar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", "file", " ", "and", " ", "remove", " ", "it", " ", "late", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "file_", "=_", "tempfile_", "._", "mktemp_", "(_", "\".", "ini", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "file_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "file", "Config_", "(_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Key", "board", "Interrupt_", ",_", "System", "Exit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "remove_", "(_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "e_", "._", "args_", ")_", "!=_", "types_", "._", "Tup", "le", "Type_", ":_", "\\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 ", " ", "_", "errcode", "_", "=_", "e_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "errcode", "_", "!=_", "RESE", "T", "\\u", "ERROR_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Config", "Sock", "et", "Receiver_", "(_", "Thread", "ing", "TC", "PS", "erver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "simple", " ", "TC", "P", " ", "socket", "-", "based", " ", "logg", "ing", " ", "config", " ", "receive", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "reus", "e\\u", "address_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "host_", "=_", "'", "local", "host", "'_", ",_", "port_", "=_", "DEF", "AUL", "T", "\\u", "LOGGING", "\\u", "CONFIG", "\\u", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Thread", "ing", "TC", "PS", "erver_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "(_", "host_", ",_", "port_", ")_", ",_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "acquir", "e", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "abort_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "release", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timeout_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serve", "\\u", "unti", "l\\u", "stopped_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "select_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "abort_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rd_", ",_", "wr_", ",_", "ex_", "=_", "select_", "._", "select_", "(_", "[_", "self_", "._", "socket_", "._", "fileno_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "]_", ",_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "handle", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "\\u", "acquir", "e", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "self_", "._", "abort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "release", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serve_", "(_", "rcv", "r_", ",_", "hdl", "r_", ",_", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "=_", "rcv", "r_", "(_", "port_", "=_", "port_", ",_", "handler_", "=_", "hdl", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "\\u", "listener_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "acquir", "e", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "listener_", "=_", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "release", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "serve", "\\u", "unti", "l\\u", "stopped_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "threading_", "._", "Thread_", "(_", "target_", "=_", "serve_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "(_", "Config", "Sock", "et", "Receiver_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Config", "Stream", "Handler_", ",_", "port_", ")_", ")_", "\\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,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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 ]
Unused local variable
Calysto/metakernel/metakernel/tests/test_magic.py
[ { "content": "def test_option():\n kernel = get_kernel()\n d = Dummy(kernel)\n assert 'Options:' in d.line_dummy.__doc__\n assert '--size' in d.line_dummy.__doc__\n\n ret = d.call_magic('line', 'dummy', '', 'hey -s400,200')\n assert ret == d\n assert d.foo == 'hey', d.foo\n assert d.size == (400, 200)\n\n ret = d.call_magic('line', 'dummy', '', 'hey there')\n assert d.foo == 'hey there'\n\n ret = d.call_magic('line', 'dummy', '', 'range(1, 10)')\n assert d.foo == range(1, 10)\n\n ret = d.call_magic('line', 'dummy', '', '[1, 2, 3]')\n assert d.foo == [1, 2, 3]\n\n ret = d.call_magic('line', 'dummy', '', 'hey -l -s400,200')\n assert d.size == (400, 200)\n assert d.foo == \"hey -l\"\n\n ret = d.call_magic('line', 'dummy', '', 'hey -s -- -s400,200')\n assert d.size == (400, 200)\n assert d.foo == \"hey -s\"", "metadata": "root.test_option", "header": "['module', '___EOS___']", "index": 66 } ]
[ { "span": "ret ", "start_line": 90, "start_column": 4, "end_line": 90, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "option_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kernel_", "=_", "get", "\\u", "kernel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "Dummy_", "(_", "kernel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "Optio", "ns", ":'_", "in_", "d_", "._", "line", "\\u", "dummy_", "._", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'--", "size", "'_", "in_", "d_", "._", "line", "\\u", "dummy_", "._", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "d_", "._", "call", "\\u", "magic_", "(_", "'", "line", "'_", ",_", "'", "dummy", "'_", ",_", "''_", ",_", "'", "hey", " ", "-", "s", "400", ",", "200", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ret_", "==_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "foo_", "==_", "'", "hey", "'_", ",_", "d_", "._", "foo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "size_", "==_", "(_", "400_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "d_", "._", "call", "\\u", "magic_", "(_", "'", "line", "'_", ",_", "'", "dummy", "'_", ",_", "''_", ",_", "'", "hey", " ", "there", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "foo_", "==_", "'", "hey", " ", "there", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "d_", "._", "call", "\\u", "magic_", "(_", "'", "line", "'_", ",_", "'", "dummy", "'_", ",_", "''_", ",_", "'", "range", "(", "1", ",", " ", "10", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "foo_", "==_", "range_", "(_", "1_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "d_", "._", "call", "\\u", "magic_", "(_", "'", "line", "'_", ",_", "'", "dummy", "'_", ",_", "''_", ",_", "'[", "1", ",", " ", "2", ",", " ", "3", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "foo_", "==_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "d_", "._", "call", "\\u", "magic_", "(_", "'", "line", "'_", ",_", "'", "dummy", "'_", ",_", "''_", ",_", "'", "hey", " ", "-", "l", " ", "-", "s", "400", ",", "200", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "size_", "==_", "(_", "400_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "foo_", "==_", "\"", "hey", " ", "-", "l", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "d_", "._", "call", "\\u", "magic_", "(_", "'", "line", "'_", ",_", "'", "dummy", "'_", ",_", "''_", ",_", "'", "hey", " ", "-", "s", " ", "--", " ", "-", "s", "400", ",", "200", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "size_", "==_", "(_", "400_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "foo_", "==_", "\"", "hey", " ", "-", "s", "\"_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Redundant assignment
Bookworm-project/BookwormDB/bookwormDB/wordcounter.py
[ { "content": "def exportToDisk(wordcounts,diskFile,keepThreshold=5):\n \"\"\"\n Periodically, the wordcounter writes what it knows to disk for dictionary values below a certain frequency:\n this lets us keep the most common words continually in memory, and only write out (say) 'the' once, at the end.\n \"\"\"\n commonwords = dict()\n for key in wordcounts.iterkeys():\n if wordcounts[key] < keepThreshold:\n key = key\n output = key + \" \" + str(wordcounts[key]) + \"\\n\"\n diskFile.write(output)\n else:\n commonwords[key] = wordcounts[key]\n return commonwords\n logging.info(\"export done\")", "metadata": "root.exportToDisk", "header": "['module', '___EOS___']", "index": 35 } ]
[ { "span": "key = key", "start_line": 43, "start_column": 12, "end_line": 43, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "Redu", "ndan", "t_", "assignment_", "[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_", "export", "To", "Disk_", "(_", "wordc", "ount", "s_", ",_", "disk", "File_", ",_", "keep", "Threshold_", "=_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Period", "ical", "ly", ",", " ", "the", " ", "wordc", "ount", "er", " ", "writes", " ", "what", " ", "it", " ", "knows", " ", "to", " ", "disk", " ", "for", " ", "dictionar", "y", " ", "values", " ", "belo", "w", " ", "a", " ", "cert", "ain", " ", "freque", "nc", "y", ":", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "lets", " ", "us", " ", "keep", " ", "the", " ", "most", " ", "common", " ", "words", " ", "continu", "ally", " ", "in", " ", "memory", ",", " ", "and", " ", "only", " ", "write", " ", "out", " ", "(", "say", ")", " ", "'", "the", "'", " ", "onc", "e", ",", " ", "at", " ", "the", " ", "end", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common", "words_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "wordc", "ount", "s_", "._", "iterkeys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "wordc", "ount", "s_", "[_", "key_", "]_", "<_", "keep", "Threshold_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "key_", "+_", "\"", " ", "\"_", "+_", "str_", "(_", "wordc", "ount", "s_", "[_", "key_", "]_", ")_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk", "File_", "._", "write_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "common", "words_", "[_", "key_", "]_", "=_", "wordc", "ount", "s_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "common", "words_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "export", " ", "don", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
twoolie/NBT/examples/anvil_blockdata.py
[ { "content": "def usage(message=None, appname=None):\n if appname == None:\n appname = os.path.basename(sys.argv[0])\n print(\"Usage: %s WORLD_FOLDER CHUNK-X CHUNK-Z BLOCKHEIGHT-Y\" % appname)\n if message:\n print(\"%s: error: %s\" % (appname, message))", "metadata": "root.usage", "header": "['module', '___EOS___']", "index": 112 } ]
[ { "span": "appname == None:", "start_line": 113, "start_column": 7, "end_line": 113, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "usage_", "(_", "message_", "=_", "None_", ",_", "appname_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "appname_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "appname_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "sys_", "._", "argv_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Us", "age", ":", " ", "%", "s", " ", "WORLD", "\\u", "FOLDER", " ", "CHUNK", "-", "X", " ", "CHUNK", "-", "Z", " ", "BLOCK", "HE", "IGHT", "-", "Y", "\"_", "%_", "appname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"%", "s", ":", " ", "error", ":", " ", "%", "s", "\"_", "%_", "(_", "appname_", ",_", "message_", ")_", ")_", "\\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, 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 ]
Unreachable code
dcramer/sentry-old/sentry/utils/compat.py
[ { "content": "\"\"\"\nsentry.utils.compat\n~~~~~~~~~~~~~~~~~~~\n\nContains compatibility imports (generally c-module replacements)\n\n:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.\n:license: BSD, see LICENSE for more details.\n\"\"\"\n\ntry:\n import cPickle as pickle\nexcept ImportError:\n import pickle\n\ntry:\n import cmath as math\nexcept ImportError:\n import math\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except ImportError:", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "sentry", ".", "util", "s", ".", "compa", "t", "\\", "10", ";", "~~~~~~~~~~~", "~~~~~", "~~~", "\\", "10", ";", "\\", "10", ";", "Contain", "s", " ", "compatibility", " ", "import", "s", " ", "(", "genera", "ll", "y", " ", "c", "-", "module", " ", "replace", "ment", "s", ")", "\\", "10", ";", "\\", "10", ";", ":", "copyr", "ight", ":", " ", "(", "c", ")", " ", "2010", " ", "by", " ", "the", " ", "Sent", "ry", " ", "Tea", "m", ",", " ", "see", " ", "AUTHOR", "S", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";", ":", "license", ":", " ", "BS", "D", ",", " ", "see", " ", "LICENSE", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "c", "Pickle_", "as_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pickle_", "\\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_", "cma", "th_", "as_", "math_", "\\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_", "math_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
google/anvil-build/anvil/build_logging.py
[ { "content": " def _validate_and_update(self, attribute):\n \"\"\"Validates the current values on this WorkUnit and propegates updates.\n\n This method validates the current WorkUnit and performs any updates that\n occur as side-effects, such as updating the start and end time. This\n method also calls change listeners and propagates change calls to parent\n WorkUnits.\n\n Args:\n attribute: A string value corresponding to the name of the attribute\n that was updated.\n Raises:\n ValueError: A ValueError is raised if any of the current values are\n in an invalid state. For instance, if the completed count is greater\n that the total count.\n \"\"\"\n if (not self._total == None and\n not self._complete == None and\n self._complete > self._total):\n raise ValueError('Complete tasks cannot be more than the total tasks.')\n if not self.start_time:\n self.start_time = util.timer()\n if self.total == self.complete and not self.total == None:\n self.end_time = util.timer()\n self._waiting = False\n for listener in self.listeners:\n listener.update(self, attribute, getattr(self, attribute))\n if self.parent:\n self.parent._validate_and_update(attribute)", "metadata": "root.WorkUnit._validate_and_update", "header": "['class', 'WorkUnit', '(', 'object', ')', ':', '___EOS___']", "index": 168 }, { "content": " @property\n def verbosity(self):\n \"\"\"Returns the effective verbosity level of this LogSource.\n\n If this LogSource has a verbosity level of INHERIT and a parent exists, then\n this accessor will return the verbosity level of the parent.\n\n Returns:\n The enums.Verbosity level of this LogSource.\n \"\"\"\n if not self.parent == None and self._verbosity == enums.Verbosity.INHERIT:\n return self.parent.verbosity\n elif self.parent == None and self._verbosity == enums.Verbosity.INHERIT:\n return enums.Verbosity.NORMAL\n return self._verbosity", "metadata": "root.LogSource.verbosity", "header": "['class', 'LogSource', '(', 'object', ')', ':', '___EOS___']", "index": 238 } ]
[ { "span": "self._total == None ", "start_line": 184, "start_column": 12, "end_line": 184, "end_column": 31 }, { "span": "self._complete == None ", "start_line": 185, "start_column": 12, "end_line": 185, "end_column": 34 }, { "span": "self.total == None:", "start_line": 190, "start_column": 43, "end_line": 190, "end_column": 61 }, { "span": "self.parent == None ", "start_line": 248, "start_column": 11, "end_line": 248, "end_column": 30 }, { "span": "self.parent == None ", "start_line": 250, "start_column": 9, "end_line": 250, "end_column": 28 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Work", "Unit_", "(_", "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", "validat", "e\\u", "and", "\\u", "update_", "(_", "self_", ",_", "attribute_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Validate", "s", " ", "the", " ", "current", " ", "values", " ", "on", " ", "this", " ", "Work", "Unit", " ", "and", " ", "prop", "egat", "es", " ", "update", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "validates", " ", "the", " ", "current", " ", "Work", "Unit", " ", "and", " ", "perform", "s", " ", "any", " ", "update", "s", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "occur", " ", "as", " ", "side", "-", "effect", "s", ",", " ", "suc", "h", " ", "as", " ", "updat", "ing", " ", "the", " ", "start", " ", "and", " ", "end", " ", "time", ".", " ", "Thi", "s", "\\", "10", ";", " ", " ", " ", " ", "method", " ", "als", "o", " ", "calls", " ", "change", " ", "listeners", " ", "and", " ", "propagate", "s", " ", "change", " ", "calls", " ", "to", " ", "parent", "\\", "10", ";", " ", " ", " ", " ", "Work", "Unit", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "attribute", ":", " ", "A", " ", "string", " ", "value", " ", "correspond", "ing", " ", "to", " ", "the", " ", "name", " ", "of", " ", "the", " ", "attribute", "\\", "10", ";", " ", " ", "tha", "t", " ", "was", " ", "update", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Value", "Error", ":", " ", "A", " ", "Value", "Error", " ", "is", " ", "raise", "d", " ", "if", " ", "any", " ", "of", " ", "the", " ", "current", " ", "values", " ", "are", "\\", "10", ";", " ", " ", "in", " ", "an", " ", "invalid", " ", "state", ".", " ", "For", " ", "instance", ",", " ", "if", " ", "the", " ", "complete", "d", " ", "count", " ", "is", " ", "great", "er", "\\", "10", ";", " ", " ", "tha", "t", " ", "the", " ", "total", " ", "count", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "\\u", "total_", "==_", "None_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "self_", "._", "\\u", "complete_", "==_", "None_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "complete_", ">_", "self_", "._", "\\u", "total_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Complete", " ", "task", "s", " ", "cann", "ot", " ", "be", " ", "more", " ", "than", " ", "the", " ", "total", " ", "task", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "start", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "start", "\\u", "time_", "=_", "util_", "._", "timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "total_", "==_", "self_", "._", "complete_", "and_", "not_", "self_", "._", "total_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "end", "\\u", "time_", "=_", "util_", "._", "timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "waiting_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "listener_", "in_", "self_", "._", "listeners_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "listener_", "._", "update_", "(_", "self_", ",_", "attribute_", ",_", "getattr_", "(_", "self_", ",_", "attribute_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "\\u", "validat", "e\\u", "and", "\\u", "update_", "(_", "attribute_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log", "Source_", "(_", "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_", "def_", "verbosity_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "effective", " ", "verbo", "sity", " ", "level", " ", "of", " ", "this", " ", "Log", "Sou", "rce", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "this", " ", "Log", "Sou", "rce", " ", "has", " ", "a", " ", "verbo", "sity", " ", "level", " ", "of", " ", "INH", "ERIT", " ", "and", " ", "a", " ", "parent", " ", "exist", "s", ",", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "accessor", " ", "will", " ", "return", " ", "the", " ", "verbo", "sity", " ", "level", " ", "of", " ", "the", " ", "parent", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "The", " ", "enum", "s", ".", "Verbos", "it", "y", " ", "level", " ", "of", " ", "this", " ", "Log", "Sou", "rce", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "parent_", "==_", "None_", "and_", "self_", "._", "\\u", "verbosity_", "==_", "enums_", "._", "Verbos", "ity_", "._", "INH", "ERIT", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "parent_", "._", "verbosity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "parent_", "==_", "None_", "and_", "self_", "._", "\\u", "verbosity_", "==_", "enums_", "._", "Verbos", "ity_", "._", "INH", "ERIT", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "enums_", "._", "Verbos", "ity_", "._", "NORMAL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "verbosity_", "\\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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 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, 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, 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 ]
Unused import
ella/ella/ella/utils/timezone.py
[ { "content": "import time\nimport calendar\nfrom pytz import utc\nfrom datetime import datetime\n\nfrom django.conf import settings\n\nuse_tz = getattr(settings, 'USE_TZ', False)\ntry:\n # try import offset-aware datetime from Django >= 1.4\n from django.utils.timezone import now, localtime, get_current_timezone, make_aware\nexcept ImportError:\n # backward compatibility with Django < 1.4 (offset-naive datetimes)\n from datetime import datetime\n now = datetime.now\n use_tz = False\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def utc_localize(dtime):\n if use_tz:\n if dtime.tzinfo:\n return utc.normalize(dtime)\n else:\n return utc.localize(dtime)\n return dtime", "metadata": "root.utc_localize", "header": "['module', '___EOS___']", "index": 18 }, { "content": "def localize(dtime):\n if use_tz:\n if dtime.tzinfo:\n return localtime(dtime)\n else:\n return make_aware(dtime, get_current_timezone())\n return dtime", "metadata": "root.localize", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def to_timestamp(dtime):\n if use_tz:\n return calendar.timegm(dtime.utctimetuple()) + float(dtime.microsecond)/1000000\n return time.mktime(dtime.timetuple()) + float(dtime.microsecond)/1000000", "metadata": "root.to_timestamp", "header": "['module', '___EOS___']", "index": 34 }, { "content": "def from_timestamp(tstamp):\n if use_tz:\n return datetime.fromtimestamp(float(tstamp), tz=utc)\n return datetime.fromtimestamp(float(tstamp))", "metadata": "root.from_timestamp", "header": "['module', '___EOS___']", "index": 39 } ]
[ { "span": "from django.utils.timezone import now, localtime, get_current_timezone, make_aware", "start_line": 10, "start_column": 4, "end_line": 10, "end_column": 86 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "calendar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pytz_", "import_", "utc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "tz_", "=_", "getattr_", "(_", "settings_", ",_", "'", "USE", "\\u", "TZ", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "import", " ", "offset", "-", "awa", "re", " ", "datetime", " ", "from", " ", "Dj", "ang", "o", " ", ">=", " ", "1.4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "utils_", "._", "timezone_", "import_", "now_", ",_", "localtime_", ",_", "get", "\\u", "current", "\\u", "timezone_", ",_", "make", "\\u", "aware_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "back", "ward", " ", "compatibility", " ", "with", " ", "Dj", "ang", "o", " ", "<", " ", "1.4", " ", "(", "offset", "-", "naive", " ", "datetimes", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "datetime_", "._", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "tz_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "utc", "\\u", "localize_", "(_", "dtime", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "use", "\\u", "tz_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dtime", "_", "._", "tzinfo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "utc_", "._", "normalize_", "(_", "dtime", "_", ")_", "\\u\\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_", "utc_", "._", "localize_", "(_", "dtime", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dtime", "_", "\\u\\u\\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_", "localize_", "(_", "dtime", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "use", "\\u", "tz_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dtime", "_", "._", "tzinfo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "localtime_", "(_", "dtime", "_", ")_", "\\u\\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_", "make", "\\u", "aware_", "(_", "dtime", "_", ",_", "get", "\\u", "current", "\\u", "timezone_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dtime", "_", "\\u\\u\\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_", "to", "\\u", "timestamp_", "(_", "dtime", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "use", "\\u", "tz_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "calendar_", "._", "time", "gm_", "(_", "dtime", "_", "._", "utc", "timetuple_", "(_", ")_", ")_", "+_", "float_", "(_", "dtime", "_", "._", "microsecond_", ")_", "/_", "1000000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "time_", "._", "mktime_", "(_", "dtime", "_", "._", "timetuple_", "(_", ")_", ")_", "+_", "float_", "(_", "dtime", "_", "._", "microsecond_", ")_", "/_", "1000000_", "\\u\\u\\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_", "from", "\\u", "timestamp_", "(_", "tsta", "mp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "use", "\\u", "tz_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datetime_", "._", "fromtimestamp_", "(_", "float_", "(_", "tsta", "mp_", ")_", ",_", "tz_", "=_", "utc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "datetime_", "._", "fromtimestamp_", "(_", "float_", "(_", "tsta", "mp_", ")_", ")_" ]
[ 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
erkyrath/tworld/twloadworld.py
[ { "content": "#!/usr/bin/env python3\n\n\"\"\"\ntwloadworld: Copyright (c) 2013, Andrew Plotkin\n(Available under the MIT License; see LICENSE file.)\n\nThis script reads a world definition file and pushes it into the database.\nThis is an administrator tool; it does no permission checking and can\nmodify or overwrite any world.\n\nI built this as a temporary measure, awaiting a full-fledged world-creation\ninterface. However, I suspect it will remain useful for various cases\n(wiping and rebuilding a Tworld database, etc).\n\"\"\"\n\nimport sys\nimport os\nimport datetime\nimport ast\nimport keyword\n\nimport bson\nfrom bson.objectid import ObjectId\nimport pymongo\n\nimport tornado.options\n\n# Set up all the options. (Generally found in the config file.)\n\n# Clever hack to parse a config file off the command line.\ntornado.options.define(\n 'config', type=str,\n help='configuration file',\n callback=lambda path: tornado.options.parse_config_file(path, final=False))\n\ntornado.options.define(\n 'python_path', type=str,\n help='Python modules directory (optional)')\n\ntornado.options.define(\n 'mongo_database', type=str, default='tworld',\n help='name of mongodb database')\n\n###\n#tornado.options.define(\n# 'removeworld', type=bool,\n# help='remove world completely')\n\ntornado.options.define(\n 'remove', type=bool,\n help='only remove the named room or room.prop')\n\ntornado.options.define(\n 'display', type=bool,\n help='only display the named room or room.prop')\n\ntornado.options.define(\n 'check', type=bool,\n help='only check consistency of the file')\n\n# Parse 'em up.\nargs = tornado.options.parse_command_line()\nopts = tornado.options.options\n\n# But tornado options don't support options after arguments. Hack to work\n# around this.\nif '--check' in args:\n args.remove('--check')\n opts.check = True\nif '--display' in args:\n args.remove('--display')\n opts.display = True\nif '--remove' in args:\n args.remove('--remove')\n opts.remove = True\nif '--removeworld' in args:\n args.remove('--removeworld')\n opts.removeworld = True\n\nif opts.python_path:\n sys.path.insert(0, opts.python_path)\n\nimport twcommon.access\nimport twcommon.interp\nfrom twcommon.misc import sluggify\n\nif not args:\n print('usage: twloadworld.py worldfile [ room ... or room.prop ... ]')\n sys.exit(-1)\n\n\n\n\n\n\n \n\n\n\n\nerrorcount = 0\n\n\nfilename = args.pop(0)\n\nworld = parse_world(filename)\n\nif errorcount:\n print('%d errors; stopping here.' % (errorcount,))\n sys.exit(1)\n\nif opts.display:\n if not args:\n args = ['.', '$player'] + world.locationlist\n for val in args:\n if '.' in val:\n lockey, dummy, key = val.partition('.')\n else:\n lockey, key = (val, None)\n if not key:\n key = None\n\n if not lockey:\n print('* (world properties)')\n print()\n if key is None:\n for key in world.proplist:\n print('%s: %s' % (key, prop_to_string(world.props[key])))\n print()\n else:\n if key not in world.props:\n error('Property not found in %s: %s' % ('*', key))\n continue\n print('%s: %s' % (key, prop_to_string(world.props[key])))\n print()\n continue\n\n if lockey == '$player':\n print('* (player properties)')\n print()\n if key is None:\n for key in world.playerproplist:\n print('%s: %s' % (key, prop_to_string(world.playerprops[key])))\n print()\n else:\n if key not in world.playerprops:\n error('Property not found in %s: %s' % ('$player', key))\n continue\n print('%s: %s' % (key, prop_to_string(world.playerprops[key])))\n print()\n continue \n \n loc = world.locations.get(lockey, None)\n if loc is None:\n error('Location not found: %s' % (lockey,))\n continue\n \n print('* %s: %s' % (loc.key, loc.name))\n print()\n if key is None:\n for key in loc.proplist:\n print('%s: %s' % (key, prop_to_string(loc.props[key])))\n print()\n else:\n if key not in loc.props:\n error('Property not found in %s: %s' % (loc.key, key))\n continue\n print('%s: %s' % (key, prop_to_string(loc.props[key])))\n print()\n\nif opts.display or opts.check:\n sys.exit(0)\n\nclient = pymongo.MongoClient(tz_aware=True)\ndb = client[opts.mongo_database]\n\ndbcreator = db.players.find_one({'name':world.creator})\nif not dbcreator:\n error('Creator %s not found in database.' % (world.creator,))\n\nworld.creatoruid = dbcreator['_id']\n\nif not world.wid:\n # Look for a world with this name. If not found, create it. If found,\n # use it (if the creator matches)\n dbworld = db.worlds.find_one({'name':world.name})\n if dbworld and dbworld.get('creator') != world.creatoruid:\n error('Found world \"%s\", but it was not created by %s.' % (world.name, world.creator))\n sys.exit(1)\nelse:\n # If the world with this wid does not exist, we'll have to create it.\n dbworld = db.worlds.find_one({'_id':ObjectId(world.wid)})\n\nif dbworld:\n wid = dbworld['_id']\n print('Found world \"%s\" (%s)' % (dbworld['name'], wid))\nelse:\n dbworld = {\n 'creator': world.creatoruid,\n 'name': world.name,\n 'copyable': world.copyable,\n 'instancing': world.instancing,\n }\n wid = db.worlds.insert(dbworld)\n dbworld = db.worlds.find_one({'_id':wid})\n if not dbworld:\n error('Unable to create world!')\n sys.exit(1)\n print('Created world \"%s\" (%s)' % (dbworld['name'], wid))\n\nworld.wid = wid\n\n# Check for existing portlists\nworld.allportlists = list(db.portlists.find({'type':'world', 'wid':world.wid}))\nworld.allportlists.sort(key = lambda x:x['_id'])\nworld.portlistmap = { val['key']:val for val in world.allportlists }\n\nif opts.remove:\n if not args:\n error('Use --removeworld to remove the entire world.')\n sys.exit(1)\n for val in args:\n if '.' in val:\n lockey, dummy, key = val.partition('.')\n else:\n lockey, key = (val, None)\n if not key:\n key = None\n\n if not lockey:\n if key is None:\n db.worldprop.remove({'wid':wid, 'locid':None})\n print('removing all world properties')\n else:\n db.worldprop.remove({'wid':wid, 'locid':None, 'key':key})\n print('removing world property: %s' % (key,))\n continue\n \n if lockey == '$player':\n if key is None:\n db.wplayerprop.remove({'wid':wid})\n print('removing all player properties')\n else:\n db.wplayerprop.remove({'wid':wid, 'key':key})\n print('removing player property: %s' % (key,))\n continue\n \n loc = world.locations.get(lockey, None)\n if loc is None:\n error('Location not found: %s' % (lockey,))\n continue\n \n if not loc.locid:\n dbloc = db.locations.find_one({'wid':wid, 'key':lockey})\n if dbloc:\n loc.locid = dbloc['_id']\n else:\n error('Location does not exist in database: %s' % (lockey,))\n continue\n \n if key is None:\n db.worldprop.remove({'wid':wid, 'locid':loc.locid})\n print('removing all properties in %s' % (lockey,))\n else:\n db.worldprop.remove({'wid':wid, 'locid':loc.locid, 'key':key})\n print('removing property in %s: %s' % (lockey, key,))\n\n sys.exit(0)\n\n# The adding-stuff-to-the-database case.\nif not args:\n args = ['.', '$player'] + world.locationlist\nfor val in args:\n if '.' in val:\n lockey, dummy, key = val.partition('.')\n else:\n lockey, key = (val, None)\n if not key:\n key = None\n\n if not lockey:\n # World properties\n if key is None:\n # All world properties\n for key in world.props:\n val = world.props[key]\n print('Writing world property: %s' % (key,))\n db.worldprop.update({'wid':wid, 'locid':None, 'key':key},\n {'wid':wid, 'locid':None, 'key':key, 'val':val},\n upsert=True)\n else:\n if key not in world.props:\n error('Property not found in %s: %s' % ('*', key))\n continue\n val = world.props[key]\n print('Writing world property: %s' % (key,))\n db.worldprop.update({'wid':wid, 'locid':None, 'key':key},\n {'wid':wid, 'locid':None, 'key':key, 'val':val},\n upsert=True)\n continue\n \n if lockey == '$player':\n # Player properties\n if key is None:\n # All player properties\n for key in world.playerprops:\n val = world.playerprops[key]\n print('Writing player property: %s' % (key,))\n db.wplayerprop.update({'wid':wid, 'uid':None, 'key':key},\n {'wid':wid, 'uid':None, 'key':key, 'val':val},\n upsert=True)\n else:\n if key not in world.playerprops:\n error('Property not found in %s: %s' % ('$player', key))\n continue\n val = world.playerprops[key]\n print('Writing player property: %s' % (key,))\n db.wplayerprop.update({'wid':wid, 'uid':None, 'key':key},\n {'wid':wid, 'uid':None, 'key':key, 'val':val},\n upsert=True)\n continue\n \n loc = world.locations.get(lockey, None)\n if loc is None:\n error('Location not found: %s' % (lockey,))\n continue\n \n if not loc.locid:\n dbloc = db.locations.find_one({'wid':wid, 'key':lockey})\n if dbloc:\n loc.locid = dbloc['_id']\n if dbloc.get('name', None) != loc.name:\n print('Updating location name: %s' % (loc.key,))\n db.locations.update({'_id':loc.locid}, {'$set':{'name':loc.name}})\n else:\n print('Creating location: %s' % (loc.key,))\n dbloc = {\n 'wid': wid,\n 'key': loc.key,\n 'name': loc.name,\n }\n loc.locid = db.locations.insert(dbloc)\n \n if key is None:\n for key in loc.props:\n val = loc.props[key]\n val = transform_prop(world, db, val)\n print('Writing property in %s: %s' % (loc.key, key,))\n db.worldprop.update({'wid':wid, 'locid':loc.locid, 'key':key},\n {'wid':wid, 'locid':loc.locid, 'key':key, 'val':val},\n upsert=True)\n else:\n if key not in loc.props:\n error('Property not found in %s: %s' % (loc.key, key))\n continue\n val = loc.props[key]\n val = transform_prop(world, db, val)\n print('Writing property in %s: %s' % (loc.key, key,))\n db.worldprop.update({'wid':wid, 'locid':loc.locid, 'key':key},\n {'wid':wid, 'locid':loc.locid, 'key':key, 'val':val},\n upsert=True)\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class World(object):\n \n", "metadata": "root.World", "header": "['module', '___EOS___']", "index": 90 }, { "content": " def __init__(self):\n self.creator = 'Admin'\n self.wid = None\n self.name = None\n self.copyable = True\n self.instancing = 'standard'\n self.props = {}\n self.proplist = []\n self.playerprops = {}\n self.playerproplist = []\n self.locations = {}\n self.locationlist = []\n self.portals = {}", "metadata": "root.World.__init__", "header": "['class', 'World', '(', 'object', ')', ':', '___EOS___']", "index": 92 }, { "content": " def check_symbols_used(self):\n self.symbolsused = set()\n all_interptext_props = []\n all_code_props = []\n for (key, propval) in self.props.items():\n if keyword.iskeyword(key):\n print('Warning: prop \"%s\" in %s is a keyword' % (key, None))\n if is_interp_text(propval):\n all_interptext_props.append( (propval['text'], None) )\n if is_code(propval):\n all_code_props.append( (key, propval['text'], None) )\n if is_move(propval):\n if propval['loc'] not in self.locations:\n print('Warning: move prop \"%s\" in %s goes to undefined loc: %s' % (key, None, propval['loc']))\n for (lockey, loc) in self.locations.items():\n for (key, propval) in loc.props.items():\n if keyword.iskeyword(key):\n print('Warning: prop \"%s\" in %s is a keyword' % (key, lockey))\n if is_interp_text(propval):\n all_interptext_props.append( (propval['text'], lockey) )\n if is_code(propval):\n all_code_props.append( (key, propval['text'], lockey) )\n if is_move(propval):\n if propval['loc'] not in self.locations:\n print('Warning: move prop \"%s\" in %s goes to undefined loc: %s' %(key, lockey, propval['loc']))\n \n for (key, text, lockey) in all_code_props:\n try:\n ast.parse(text, filename='%s.%s' % (lockey, key,))\n except Exception as ex:\n print('Warning: code prop \"%s\" in %s does not parse: %s' % (key, lockey, ex))\n\n for (text, lockey) in all_interptext_props:\n for nod in twcommon.interp.parse(text):\n if isinstance(nod, twcommon.interp.Link):\n self.symbolsused.add( (nod.target, lockey) )\n if isinstance(nod, twcommon.interp.Interpolate):\n self.symbolsused.add( (nod.expr, lockey) )\n\n for (symbol, lockey) in self.symbolsused:\n if not symbol.isidentifier():\n try:\n ast.parse(symbol)\n except:\n print('Warning: code snippet \"%s\" in %s does not parse.' % (symbol, lockey,)) \n continue\n if lockey is None:\n loc = None\n else:\n loc = self.locations[lockey]\n if loc and symbol in loc.props:\n continue\n if symbol in self.props:\n continue\n print('Warning: symbol \"%s\" in %s is not defined.' % (symbol, lockey,))", "metadata": "root.World.check_symbols_used", "header": "['class', 'World', '(', 'object', ')', ':', '___EOS___']", "index": 106 }, { "content": "class Location(object):", "metadata": "root.Location", "header": "['module', '___EOS___']", "index": 162 }, { "content": " def __init__(self, name, key=None):\n self.name = name\n if key is None:\n self.key = sluggify(name)\n else:\n self.key = key\n self.locid = None\n self.props = {}\n self.proplist = []", "metadata": "root.Location.__init__", "header": "['class', 'Location', '(', 'object', ')', ':', '___EOS___']", "index": 163 }, { "content": " def __repr__(self):\n return '<Location %s: \"%s\">' % (self.key, self.name)", "metadata": "root.Location.__repr__", "header": "['class', 'Location', '(', 'object', ')', ':', '___EOS___']", "index": 172 }, { "content": "def parse_world(filename):\n world = World()\n curloc = None\n curprop = None\n \n fl = open(filename)\n while True:\n ln = fl.readline()\n if not ln:\n break\n ln = ln.rstrip()\n isindent = 0\n val = ln.lstrip()\n if len(val) < len(ln):\n isindent = len(ln) - len(val)\n ln = val\n \n if not ln or ln.startswith('#'):\n continue\n if ln.startswith('***'):\n break\n\n if ln.startswith('*'):\n # New location.\n curprop = None\n lockey, dummy, locname = ln[1:].partition(':')\n lockey = lockey.strip()\n locname = locname.strip()\n if not locname:\n locname = lockey\n lockey = sluggify(locname)\n if lockey in world.locations:\n error('Location defined twice: %s' % (lockey,))\n curloc = Location(locname, lockey)\n world.locations[lockey] = curloc\n world.locationlist.append(lockey)\n curprop = 'desc'\n continue\n\n if isindent and curprop is not None:\n ### Fails to handle extending player props\n if not curloc:\n if curprop not in world.proplist:\n world.proplist.append(curprop)\n append_to_prop(world.props, curprop, ln, indent=isindent)\n else:\n if curprop not in curloc.proplist:\n curloc.proplist.append(curprop)\n append_to_prop(curloc.props, curprop, ln, indent=isindent)\n continue\n\n key, dummy, val = ln.partition(':')\n if not dummy:\n error('Line does not define a property: %s' % (ln[:36],))\n continue\n\n key = key.strip()\n val = val.strip()\n\n if not curloc and key.startswith('$'):\n curprop = None\n if key == '$wid':\n world.wid = val\n elif key == '$name':\n world.name = val\n elif key == '$creator':\n world.creator = val\n elif key == '$copyable':\n world.copyable = not (val.lower()[0] in ['0', 'n', 'f'])\n elif key == '$instancing':\n world.instancing = val\n if val not in ('shared', 'solo', 'standard'):\n error('$instancing value must be shared, solo, or standard')\n elif key.startswith('$player.'):\n key = key[8:].strip()\n propval = parse_prop(val)\n if key in world.playerprops:\n error('Player key defined twice: %s' % (key,))\n world.playerprops[key] = propval\n world.playerproplist.append(key)\n curprop = key\n continue\n else:\n error('Unknown $key: %s' % (key,))\n continue\n \n if not key.isidentifier():\n error('Property key is not valid: %s' % (key,))\n\n propval = parse_prop(val)\n \n if not curloc:\n if key in world.props:\n error('World key defined twice: %s' % (key,))\n world.props[key] = propval\n world.proplist.append(key)\n curprop = key\n else:\n if key in curloc.props:\n error('Location key defined twice in %s: %s' % (curloc.key, key,))\n curloc.props[key] = propval\n curloc.proplist.append(key)\n curprop = key\n \n fl.close()\n world.check_symbols_used()\n return world", "metadata": "root.parse_world", "header": "['module', '___EOS___']", "index": 175 }, { "content": "def parse_prop(prop):\n if prop.startswith('*'):\n key, dummy, val = prop[1:].partition(' ')\n \n if not val and key not in ('code', 'gentext'):\n error('%s must be followed by a value' % (key,))\n return None\n \n if key == 'portlist':\n plistkey, dummy, val = val.partition(' ')\n res = {'type':'portlist', 'plistkey':plistkey,\n '_templist':[]}\n if 'single' in val.split():\n res['focus'] = True\n return res\n \n if key == 'move':\n val = sluggify(val.strip())\n return {'type':'move', 'loc':val}\n elif key == 'focus':\n val = sluggify(val.strip())\n return {'type':'focus', 'key':val}\n elif key == 'event':\n return {'type':'event', 'text':val}\n elif key == 'panic':\n return {'type':'panic', 'text':val} # theoretically the text is optional\n elif key == 'text':\n return {'type':'text', 'text':val}\n elif key == 'gentext':\n return {'type':'gentext', 'text':val}\n elif key == 'code':\n return {'type':'code', 'text':val}\n elif key == 'selfdesc':\n return {'type':'selfdesc', 'text':val}\n elif key == 'editstr':\n return {'type':'editstr', 'key':val}\n elif key == 'datetime':\n val = datetime.datetime.strptime(val, '%Y-%m-%d')\n return datetime.datetime(year=val.year, month=val.month, day=val.day, tzinfo=datetime.timezone.utc)\n else:\n error('Unknown special property type: *%s' % (key,))\n return None\n\n try:\n propval = ast.literal_eval(prop)\n # We test-encode the new value to bson, so that we can be strict\n # and catch errors.\n dummy = bson.BSON.encode({'val':propval}, check_keys=True)\n return propval\n except:\n pass\n \n return {'type':'text', 'text':prop}", "metadata": "root.parse_prop", "header": "['module', '___EOS___']", "index": 283 }, { "content": "def append_to_prop(dic, key, ln, indent=0):\n val = dic.get(key, None)\n if not val:\n val = {'type':'text', 'text':ln}\n dic[key] = val\n elif type(val) is str:\n val += ('\\n\\n' + ln)\n dic[key] = val\n elif type(val) is dict and ln.startswith('-'):\n subkey, dummy, subval = ln[1:].partition(':')\n if not dummy:\n error('Continuation *line must contain a colon')\n return\n subkey = subkey.strip()\n subval = subval.strip()\n if val.get('type', None) == 'portlist' and subkey == 'portal':\n subls = [ s2val.strip() for s2val in subval.split(',') ]\n if len(subls) != 4:\n error('Portal property must have four fields')\n return None\n val['_templist'].append(subls)\n else:\n val[subkey] = subval\n elif type(val) is dict and val.get('type', None) in ('code', 'gentext'):\n if '_baseindent' not in val:\n val['_baseindent'] = indent\n indentstr = ' ' * (indent - val['_baseindent'])\n if not val['text'].strip():\n val['text'] = ''\n else:\n indentstr = '\\n' + indentstr\n val['text'] += (indentstr + ln)\n elif type(val) is dict and 'text' in val:\n # Covers {text}, {event}\n val['text'] += ('\\n\\n' + ln)\n else:\n error('Cannot append to property %s' % (key,))", "metadata": "root.append_to_prop", "header": "['module', '___EOS___']", "index": 337 }, { "content": "def transform_prop(world, db, val):\n if type(val) is not dict:\n return val\n key = val.get('type', None)\n\n if key == 'editstr':\n if 'editaccess' in val:\n val['editaccess'] = twcommon.access.level_named(val['editaccess'])\n \n if key == 'portlist':\n if val['plistkey'] in world.portlistmap:\n plistid = world.portlistmap[val['plistkey']]['_id']\n else:\n plistid = db.portlists.insert({'type':'world', 'wid':world.wid, 'key':val['plistkey']})\n print('Created portlist %s (%s)' % (val['plistkey'], plistid,))\n # Clean out the portlist and rebuild it\n db.portals.remove({'plistid':plistid, 'iid':None})\n listpos = 0.0\n portid = None\n for quad in val['_templist']:\n tocreator = db.players.find_one({'name':quad[1]})\n if not tocreator:\n error('Creator not found for portal: %s, %s' % (quad[0], quad[1]))\n return '[Portal world creator not found]'\n toworld = db.worlds.find_one({'name':quad[0], 'creator':tocreator['_id']})\n if not toworld:\n error('World not found for portal: %s' % (quad[0],))\n return '[Portal world not found]'\n toloc = db.locations.find_one({'wid':toworld['_id'], 'key':quad[3]})\n if not toloc:\n error('Location not found for portal: %s, %s' % (quad[0], quad[3]))\n return '[Portal location not found]'\n query = { 'plistid':plistid, 'iid':None, 'wid':toworld['_id'], 'locid':toloc['_id'] }\n if quad[2] in ('personal', 'global', 'same'):\n query['scid'] = quad[2]\n else:\n query['scid'] = ObjectId(quad[2])\n query['listpos'] = listpos\n listpos += 1.0\n portid = db.portals.insert(query)\n print('Created portal %s (%s)' % (quad, portid,))\n newval = { 'type':'portlist', 'plistkey':val['plistkey'] }\n if 'text' in val:\n newval['text'] = val['text']\n if 'focus' in val:\n newval['focus'] = True\n if 'editaccess' in val:\n newval['editaccess'] = twcommon.access.level_named(val['editaccess'])\n if 'readaccess' in val:\n newval['readaccess'] = twcommon.access.level_named(val['readaccess'])\n return newval\n \n \n return val", "metadata": "root.transform_prop", "header": "['module', '___EOS___']", "index": 375 }, { "content": "def prop_to_string(val):\n if type(val) is not dict:\n return repr(val)\n key = val.get('type', None)\n if key == 'move':\n return '*move %s' % (val['loc'],)\n if key == 'focus':\n return '*focus %s' % (val['key'],)\n if key == 'event':\n res = '*event %s' % (val['text'],)\n if 'otext' in val:\n res += ('\\n\\t- otext: ' + val['otext'])\n return res\n if key == 'panic':\n res = '*panic %s' % (val['text'],)\n if 'otext' in val:\n res += ('\\n\\t- otext: ' + val['otext'])\n return res\n if key == 'selfdesc':\n res = '*selfdesc %s' % (val['text'],)\n return res\n if key == 'text':\n val = val['text']\n if '\\n\\n' in val:\n return val.replace('\\n\\n', '\\n\\t')\n return val\n if key == 'gentext':\n val = val['text']\n if '\\n' not in text:\n return '*gentext %s' % (text,)\n else:\n ls = [ ' '+val for val in text.split('\\n') ]\n text = '\\n'.join(ls)\n return '*gentext\\n%s' % (text,)\n if key == 'code':\n text = val['text']\n if '\\n' not in text:\n return '*code %s' % (text,)\n else:\n ls = [ ' '+val for val in text.split('\\n') ]\n text = '\\n'.join(ls)\n return '*code\\n%s' % (text,)\n return repr(val)", "metadata": "root.prop_to_string", "header": "['module', '___EOS___']", "index": 430 }, { "content": "def is_interp_text(res):\n ### events also?\n return (type(res) is dict and res.get('type', None) == 'text')", "metadata": "root.is_interp_text", "header": "['module', '___EOS___']", "index": 474 }, { "content": "def is_code(res):\n return (type(res) is dict and res.get('type', None) == 'code')", "metadata": "root.is_code", "header": "['module', '___EOS___']", "index": 478 }, { "content": "def is_move(res):\n return (type(res) is dict and res.get('type', None) == 'move')", "metadata": "root.is_move", "header": "['module', '___EOS___']", "index": 481 }, { "content": "def error(msg):\n global errorcount\n errorcount = errorcount + 1\n print('Error: %s' % (msg,))", "metadata": "root.error", "header": "['module', '___EOS___']", "index": 486 } ]
[ { "span": "import os", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "tw", "load", "world", ":", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", ",", " ", "Andre", "w", " ", "Plot", "kin", "\\", "10", ";", "(", "Avail", "able", " ", "under", " ", "the", " ", "MIT", " ", "License", ";", " ", "see", " ", "LICENSE", " ", "file", ".)", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "script", " ", "reads", " ", "a", " ", "world", " ", "definit", "ion", " ", "file", " ", "and", " ", "pushe", "s", " ", "it", " ", "int", "o", " ", "the", " ", "databa", "se", ".", "\\", "10", ";", "Thi", "s", " ", "is", " ", "an", " ", "administrat", "or", " ", "tool", ";", " ", "it", " ", "doe", "s", " ", "no", " ", "permissi", "on", " ", "checking", " ", "and", " ", "can", "\\", "10", ";", "modif", "y", " ", "or", " ", "overwrit", "e", " ", "any", " ", "world", ".", "\\", "10", ";", "\\", "10", ";", "I", " ", "bui", "lt", " ", "this", " ", "as", " ", "a", " ", "temporar", "y", " ", "measure", ",", " ", "await", "ing", " ", "a", " ", "full", "-", "fle", "dge", "d", " ", "world", "-", "creati", "on", "\\", "10", ";", "interface", ".", " ", "Ho", "we", "ver", ",", " ", "I", " ", "suspe", "ct", " ", "it", " ", "will", " ", "rema", "in", " ", "usef", "ul", " ", "for", " ", "vari", "ous", " ", "case", "s", "\\", "10", ";", "(", "wi", "ping", " ", "and", " ", "rebu", "ild", "ing", " ", "a", " ", "Tw", "orl", "d", " ", "databa", "se", ",", " ", "etc", ").", "\\", "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_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ast_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "keyword_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "bson_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bson_", "._", "objectid", "_", "import_", "Object", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pymongo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "tornado_", "._", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "up", " ", "all", " ", "the", " ", "options", ".", " ", "(", "General", "ly", " ", "found", " ", "in", " ", "the", " ", "config", " ", "file", ".)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cle", "ver", " ", "hack", " ", "to", " ", "parse", " ", "a", " ", "config", " ", "file", " ", "off", " ", "the", " ", "command", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "tornado_", "._", "options_", "._", "define_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "config", "'_", ",_", "type_", "=_", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "configura", "tion", " ", "file", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "callback_", "=_", "lambda_", "path_", ":_", "tornado_", "._", "options_", "._", "parse", "\\u", "config", "\\u", "file_", "(_", "path_", ",_", "final_", "=_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tornado_", "._", "options_", "._", "define_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "python", "\\u", "path", "'_", ",_", "type_", "=_", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Pyth", "on", " ", "module", "s", " ", "director", "y", " ", "(", "option", "al", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tornado_", "._", "options_", "._", "define_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mongo", "\\u", "databa", "se", "'_", ",_", "type_", "=_", "str_", ",_", "default_", "=_", "'", "two", "rl", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "name", " ", "of", " ", "mongodb", " ", "databa", "se", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "torn", "ado", ".", "options", ".", "defin", "e", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'", "remove", "world", "',", " ", "type", "=", "bool", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "help", "='", "remove", " ", "world", " ", "complete", "ly", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tornado_", "._", "options_", "._", "define_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "remove", "'_", ",_", "type_", "=_", "bool_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "only", " ", "remove", " ", "the", " ", "named", " ", "room", " ", "or", " ", "room", ".", "prop", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tornado_", "._", "options_", "._", "define_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "display", "'_", ",_", "type_", "=_", "bool_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "only", " ", "display", " ", "the", " ", "named", " ", "room", " ", "or", " ", "room", ".", "prop", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tornado_", "._", "options_", "._", "define_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "check", "'_", ",_", "type_", "=_", "bool_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "only", " ", "check", " ", "consiste", "nc", "y", " ", "of", " ", "the", " ", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pars", "e", " ", "'", "em", " ", "up", "._", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "tornado_", "._", "options_", "._", "parse", "\\u", "command", "\\u", "line_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "=_", "tornado_", "._", "options_", "._", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bu", "t", " ", "torn", "ado", " ", "options", " ", "don", "'", "t", " ", "support", " ", "options", " ", "after", " ", "argu", "ment", "s", ".", " ", "Hack", " ", "to", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "aro", "und", " ", "this", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'--", "check", "'_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "remove_", "(_", "'--", "check", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "check_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'--", "display", "'_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "remove_", "(_", "'--", "display", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "display_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'--", "remove", "'_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "remove_", "(_", "'--", "remove", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "remove_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'--", "remove", "world", "'_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "remove_", "(_", "'--", "remove", "world", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "remove", "world_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opts_", "._", "python", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "opts_", "._", "python", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "tw", "common_", "._", "access_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tw", "common_", "._", "interp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tw", "common_", "._", "misc_", "import_", "slug", "gif", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "usage", ":", " ", "tw", "load", "world", ".", "py", " ", "world", "file", " ", "[", " ", "room", " ", "...", " ", "or", " ", "room", ".", "prop", " ", "...", " ", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "error", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filename_", "=_", "args_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "world_", "=_", "parse", "\\u", "world_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "error", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'%", "d", " ", "error", "s", ";", " ", "stopping", " ", "here", ".'_", "%_", "(_", "error", "count_", ",_", ")_", ")_", "\\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_", "opts_", "._", "display_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "'.'_", ",_", "'$", "player", "'_", "]_", "+_", "world_", "._", "location", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "val_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'.'_", "in_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lock", "ey_", ",_", "dummy_", ",_", "key_", "=_", "val_", "._", "partition_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lock", "ey_", ",_", "key_", "=_", "(_", "val_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "lock", "ey_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'*", " ", "(", "world", " ", "proper", "ties", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "world_", "._", "prop", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", "prop", "\\u", "to", "\\u", "string_", "(_", "world_", "._", "props_", "[_", "key_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\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_", "key_", "not_", "in_", "world_", "._", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "error_", "(_", "'", "Proper", "ty", " ", "not", " ", "found", " ", "in", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "'*'_", ",_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", "prop", "\\u", "to", "\\u", "string_", "(_", "world_", "._", "props_", "[_", "key_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lock", "ey_", "==_", "'$", "player", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'*", " ", "(", "player", " ", "proper", "ties", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "world_", "._", "player", "prop", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", "prop", "\\u", "to", "\\u", "string_", "(_", "world_", "._", "player", "props_", "[_", "key_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\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_", "key_", "not_", "in_", "world_", "._", "player", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "error_", "(_", "'", "Proper", "ty", " ", "not", " ", "found", " ", "in", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "'$", "player", "'_", ",_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", "prop", "\\u", "to", "\\u", "string_", "(_", "world_", "._", "player", "props_", "[_", "key_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loc_", "=_", "world_", "._", "locations_", "._", "get_", "(_", "lock", "ey_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "loc_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Locat", "ion", " ", "not", " ", "found", ":", " ", "%", "s", "'_", "%_", "(_", "lock", "ey_", ",_", ")_", ")_", "\\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_", "print_", "(_", "'*", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "loc_", "._", "key_", ",_", "loc_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "loc_", "._", "prop", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", "prop", "\\u", "to", "\\u", "string_", "(_", "loc_", "._", "props_", "[_", "key_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\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_", "key_", "not_", "in_", "loc_", "._", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Proper", "ty", " ", "not", " ", "found", " ", "in", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "loc_", "._", "key_", ",_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", "prop", "\\u", "to", "\\u", "string_", "(_", "loc_", "._", "props_", "[_", "key_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\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_", "opts_", "._", "display_", "or_", "opts_", "._", "check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "client_", "=_", "pymongo_", "._", "Mon", "go", "Client_", "(_", "tz", "\\u", "aware_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "=_", "client_", "[_", "opts_", "._", "mongo", "\\u", "database_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dbc", "rea", "tor_", "=_", "db_", "._", "players_", "._", "find", "\\u", "one_", "(_", "{_", "'", "name", "'_", ":_", "world_", "._", "creator_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "dbc", "rea", "tor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Creat", "or", " ", "%", "s", " ", "not", " ", "found", " ", "in", " ", "databa", "se", ".'_", "%_", "(_", "world_", "._", "creator_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "world_", "._", "creat", "or", "uid_", "=_", "dbc", "rea", "tor_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "world_", "._", "wid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Look", " ", "for", " ", "a", " ", "world", " ", "with", " ", "this", " ", "name", ".", " ", "If", " ", "not", " ", "found", ",", " ", "create", " ", "it", ".", " ", "If", " ", "found", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "it", " ", "(", "if", " ", "the", " ", "creat", "or", " ", "matche", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "world_", "=_", "db_", "._", "world", "s_", "._", "find", "\\u", "one_", "(_", "{_", "'", "name", "'_", ":_", "world_", "._", "name_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "db", "world_", "and_", "db", "world_", "._", "get_", "(_", "'", "creat", "or", "'_", ")_", "!=_", "world_", "._", "creat", "or", "uid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Foun", "d", " ", "world", " ", "\"%", "s", "\",", " ", "but", " ", "it", " ", "was", " ", "not", " ", "created", " ", "by", " ", "%", "s", ".'_", "%_", "(_", "world_", "._", "name_", ",_", "world_", "._", "creator_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "world", " ", "with", " ", "this", " ", "wid", " ", "doe", "s", " ", "not", " ", "exist", ",", " ", "we", "'", "ll", " ", "have", " ", "to", " ", "create", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "world_", "=_", "db_", "._", "world", "s_", "._", "find", "\\u", "one_", "(_", "{_", "'\\u", "id", "'_", ":_", "Object", "Id_", "(_", "world_", "._", "wid_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "world_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wid_", "=_", "db", "world_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Foun", "d", " ", "world", " ", "\"%", "s", "\"", " ", "(%", "s", ")'_", "%_", "(_", "db", "world_", "[_", "'", "name", "'_", "]_", ",_", "wid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "world_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "creat", "or", "'_", ":_", "world_", "._", "creat", "or", "uid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "world_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "copy", "able", "'_", ":_", "world_", "._", "copy", "able_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instan", "cing", "'_", ":_", "world_", "._", "instan", "cing", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wid_", "=_", "db_", "._", "world", "s_", "._", "insert_", "(_", "db", "world_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "world_", "=_", "db_", "._", "world", "s_", "._", "find", "\\u", "one_", "(_", "{_", "'\\u", "id", "'_", ":_", "wid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "db", "world_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Una", "ble", " ", "to", " ", "create", " ", "world", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'", "Creat", "ed", " ", "world", " ", "\"%", "s", "\"", " ", "(%", "s", ")'_", "%_", "(_", "db", "world_", "[_", "'", "name", "'_", "]_", ",_", "wid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "world_", "._", "wid_", "=_", "wid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "exist", "ing", " ", "port", "lists_", "\\u\\u\\uNL\\u\\u\\u_", "world_", "._", "allp", "ort", "lists_", "=_", "list_", "(_", "db_", "._", "port", "lists_", "._", "find_", "(_", "{_", "'", "type", "'_", ":_", "'", "world", "'_", ",_", "'", "wid", "'_", ":_", "world_", "._", "wid_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "world_", "._", "allp", "ort", "lists_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "'\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "world_", "._", "port", "list", "map_", "=_", "{_", "val_", "[_", "'", "key", "'_", "]_", ":_", "val_", "for_", "val_", "in_", "world_", "._", "allp", "ort", "lists_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "opts_", "._", "remove_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Us", "e", " ", "--", "remove", "world", " ", "to", " ", "remove", " ", "the", " ", "entire", " ", "world", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "val_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'.'_", "in_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lock", "ey_", ",_", "dummy_", ",_", "key_", "=_", "val_", "._", "partition_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lock", "ey_", ",_", "key_", "=_", "(_", "val_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "lock", "ey_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "world", "prop_", "._", "remove_", "(_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "loci", "d", "'_", ":_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "remo", "ving", " ", "all", " ", "world", " ", "proper", "ties", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "world", "prop_", "._", "remove_", "(_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "loci", "d", "'_", ":_", "None_", ",_", "'", "key", "'_", ":_", "key_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "remo", "ving", " ", "world", " ", "property", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lock", "ey_", "==_", "'$", "player", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "wp", "layer", "prop_", "._", "remove_", "(_", "{_", "'", "wid", "'_", ":_", "wid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "remo", "ving", " ", "all", " ", "player", " ", "proper", "ties", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "wp", "layer", "prop_", "._", "remove_", "(_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "key", "'_", ":_", "key_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "remo", "ving", " ", "player", " ", "property", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loc_", "=_", "world_", "._", "locations_", "._", "get_", "(_", "lock", "ey_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "loc_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Locat", "ion", " ", "not", " ", "found", ":", " ", "%", "s", "'_", "%_", "(_", "lock", "ey_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "loc_", "._", "loci", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dbl", "oc_", "=_", "db_", "._", "locations_", "._", "find", "\\u", "one_", "(_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "key", "'_", ":_", "lock", "ey_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dbl", "oc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loc_", "._", "loci", "d_", "=_", "dbl", "oc_", "[_", "'\\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 ", " _", "error_", "(_", "'", "Locat", "ion", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "databa", "se", ":", " ", "%", "s", "'_", "%_", "(_", "lock", "ey_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "world", "prop_", "._", "remove_", "(_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "loci", "d", "'_", ":_", "loc_", "._", "loci", "d_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "remo", "ving", " ", "all", " ", "proper", "ties", " ", "in", " ", "%", "s", "'_", "%_", "(_", "lock", "ey_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "world", "prop_", "._", "remove_", "(_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "loci", "d", "'_", ":_", "loc_", "._", "loci", "d_", ",_", "'", "key", "'_", ":_", "key_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "remo", "ving", " ", "property", " ", "in", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "lock", "ey_", ",_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "addin", "g", "-", "stu", "ff", "-", "to", "-", "the", "-", "databa", "se", " ", "case", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "'.'_", ",_", "'$", "player", "'_", "]_", "+_", "world_", "._", "location", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "val_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'.'_", "in_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lock", "ey_", ",_", "dummy_", ",_", "key_", "=_", "val_", "._", "partition_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lock", "ey_", ",_", "key_", "=_", "(_", "val_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "lock", "ey_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wor", "ld", " ", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "All", " ", "world", " ", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "world_", "._", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "world_", "._", "props_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Writ", "ing", " ", "world", " ", "property", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "world", "prop_", "._", "update_", "(_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "loci", "d", "'_", ":_", "None_", ",_", "'", "key", "'_", ":_", "key_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "loci", "d", "'_", ":_", "None_", ",_", "'", "key", "'_", ":_", "key_", ",_", "'", "val", "'_", ":_", "val_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "upsert_", "=_", "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_", "key_", "not_", "in_", "world_", "._", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Proper", "ty", " ", "not", " ", "found", " ", "in", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "'*'_", ",_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "=_", "world_", "._", "props_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Writ", "ing", " ", "world", " ", "property", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "world", "prop_", "._", "update_", "(_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "loci", "d", "'_", ":_", "None_", ",_", "'", "key", "'_", ":_", "key_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "loci", "d", "'_", ":_", "None_", ",_", "'", "key", "'_", ":_", "key_", ",_", "'", "val", "'_", ":_", "val_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "upsert_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lock", "ey_", "==_", "'$", "player", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Player", " ", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "All", " ", "player", " ", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "world_", "._", "player", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "world_", "._", "player", "props_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Writ", "ing", " ", "player", " ", "property", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "wp", "layer", "prop_", "._", "update_", "(_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "uid", "'_", ":_", "None_", ",_", "'", "key", "'_", ":_", "key_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "uid", "'_", ":_", "None_", ",_", "'", "key", "'_", ":_", "key_", ",_", "'", "val", "'_", ":_", "val_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "upsert_", "=_", "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_", "key_", "not_", "in_", "world_", "._", "player", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Proper", "ty", " ", "not", " ", "found", " ", "in", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "'$", "player", "'_", ",_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "=_", "world_", "._", "player", "props_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Writ", "ing", " ", "player", " ", "property", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "wp", "layer", "prop_", "._", "update_", "(_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "uid", "'_", ":_", "None_", ",_", "'", "key", "'_", ":_", "key_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "uid", "'_", ":_", "None_", ",_", "'", "key", "'_", ":_", "key_", ",_", "'", "val", "'_", ":_", "val_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "upsert_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loc_", "=_", "world_", "._", "locations_", "._", "get_", "(_", "lock", "ey_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "loc_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Locat", "ion", " ", "not", " ", "found", ":", " ", "%", "s", "'_", "%_", "(_", "lock", "ey_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "loc_", "._", "loci", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dbl", "oc_", "=_", "db_", "._", "locations_", "._", "find", "\\u", "one_", "(_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "key", "'_", ":_", "lock", "ey_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dbl", "oc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loc_", "._", "loci", "d_", "=_", "dbl", "oc_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dbl", "oc_", "._", "get_", "(_", "'", "name", "'_", ",_", "None_", ")_", "!=_", "loc_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Up", "dati", "ng", " ", "location", " ", "name", ":", " ", "%", "s", "'_", "%_", "(_", "loc_", "._", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "locations_", "._", "update_", "(_", "{_", "'\\u", "id", "'_", ":_", "loc_", "._", "loci", "d_", "}_", ",_", "{_", "'$", "set", "'_", ":_", "{_", "'", "name", "'_", ":_", "loc_", "._", "name_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Creat", "ing", " ", "location", ":", " ", "%", "s", "'_", "%_", "(_", "loc_", "._", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbl", "oc_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wid", "'_", ":_", "wid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "loc_", "._", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "loc_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc_", "._", "loci", "d_", "=_", "db_", "._", "locations_", "._", "insert_", "(_", "dbl", "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_", "if_", "key_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "loc_", "._", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "loc_", "._", "props_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "transform", "\\u", "prop_", "(_", "world_", ",_", "db_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Writ", "ing", " ", "property", " ", "in", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "loc_", "._", "key_", ",_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "world", "prop_", "._", "update_", "(_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "loci", "d", "'_", ":_", "loc_", "._", "loci", "d_", ",_", "'", "key", "'_", ":_", "key_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "loci", "d", "'_", ":_", "loc_", "._", "loci", "d_", ",_", "'", "key", "'_", ":_", "key_", ",_", "'", "val", "'_", ":_", "val_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "upsert_", "=_", "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_", "key_", "not_", "in_", "loc_", "._", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Proper", "ty", " ", "not", " ", "found", " ", "in", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "loc_", "._", "key_", ",_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "=_", "loc_", "._", "props_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "transform", "\\u", "prop_", "(_", "world_", ",_", "db_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Writ", "ing", " ", "property", " ", "in", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "loc_", "._", "key_", ",_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "world", "prop_", "._", "update_", "(_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "loci", "d", "'_", ":_", "loc_", "._", "loci", "d_", ",_", "'", "key", "'_", ":_", "key_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "wid", "'_", ":_", "wid_", ",_", "'", "loci", "d", "'_", ":_", "loc_", "._", "loci", "d_", ",_", "'", "key", "'_", ":_", "key_", ",_", "'", "val", "'_", ":_", "val_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "upsert_", "=_", "True_", ")_", "\\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_", "World_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "World_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "creator_", "=_", "'", "Admi", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wid_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "copy", "able_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instan", "cing", "_", "=_", "'", "standard", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "props_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "prop", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "player", "props_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "player", "prop", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "locations_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "location", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "portal", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "World_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "symbols", "\\u", "used_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "symbols", "used_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "interp", "text", "\\u", "props_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "code", "\\u", "props_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "key_", ",_", "prop", "val_", ")_", "in_", "self_", "._", "props_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "keyword_", "._", "isk", "ey", "word_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Warn", "ing", ":", " ", "prop", " ", "\"%", "s", "\"", " ", "in", " ", "%", "s", " ", "is", " ", "a", " ", "keyw", "ord", "'_", "%_", "(_", "key_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "interp", "\\u", "text_", "(_", "prop", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "interp", "text", "\\u", "props_", "._", "append_", "(_", "(_", "prop", "val_", "[_", "'", "text", "'_", "]_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "code_", "(_", "prop", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "code", "\\u", "props_", "._", "append_", "(_", "(_", "key_", ",_", "prop", "val_", "[_", "'", "text", "'_", "]_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "move_", "(_", "prop", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "prop", "val_", "[_", "'", "loc", "'_", "]_", "not_", "in_", "self_", "._", "locations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'", "Warn", "ing", ":", " ", "move", " ", "prop", " ", "\"%", "s", "\"", " ", "in", " ", "%", "s", " ", "go", "es", " ", "to", " ", "undefined", " ", "loc", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", "None_", ",_", "prop", "val_", "[_", "'", "loc", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "(_", "lock", "ey_", ",_", "loc_", ")_", "in_", "self_", "._", "locations_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "(_", "key_", ",_", "prop", "val_", ")_", "in_", "loc_", "._", "props_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "keyword_", "._", "isk", "ey", "word_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'", "Warn", "ing", ":", " ", "prop", " ", "\"%", "s", "\"", " ", "in", " ", "%", "s", " ", "is", " ", "a", " ", "keyw", "ord", "'_", "%_", "(_", "key_", ",_", "lock", "ey_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "interp", "\\u", "text_", "(_", "prop", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "all", "\\u", "interp", "text", "\\u", "props_", "._", "append_", "(_", "(_", "prop", "val_", "[_", "'", "text", "'_", "]_", ",_", "lock", "ey_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "code_", "(_", "prop", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "all", "\\u", "code", "\\u", "props_", "._", "append_", "(_", "(_", "key_", ",_", "prop", "val_", "[_", "'", "text", "'_", "]_", ",_", "lock", "ey_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "move_", "(_", "prop", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "prop", "val_", "[_", "'", "loc", "'_", "]_", "not_", "in_", "self_", "._", "locations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "(_", "'", "Warn", "ing", ":", " ", "move", " ", "prop", " ", "\"%", "s", "\"", " ", "in", " ", "%", "s", " ", "go", "es", " ", "to", " ", "undefined", " ", "loc", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", "lock", "ey_", ",_", "prop", "val_", "[_", "'", "loc", "'_", "]_", ")_", ")_", "\\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_", "for_", "(_", "key_", ",_", "text_", ",_", "lock", "ey_", ")_", "in_", "all", "\\u", "code", "\\u", "props_", ":_", "\\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 ", " _", "ast_", "._", "parse_", "(_", "text_", ",_", "filename_", "=_", "'%", "s", ".", "%", "s", "'_", "%_", "(_", "lock", "ey_", ",_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Warn", "ing", ":", " ", "code", " ", "prop", " ", "\"%", "s", "\"", " ", "in", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "parse", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", "lock", "ey_", ",_", "ex_", ")_", ")_", "\\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_", "(_", "text_", ",_", "lock", "ey_", ")_", "in_", "all", "\\u", "interp", "text", "\\u", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "nod", "_", "in_", "tw", "common_", "._", "interp_", "._", "parse_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "nod", "_", ",_", "tw", "common_", "._", "interp_", "._", "Link_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "symbols", "used_", "._", "add_", "(_", "(_", "nod", "_", "._", "target_", ",_", "lock", "ey_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "nod", "_", ",_", "tw", "common_", "._", "interp_", "._", "Interpolate", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "symbols", "used_", "._", "add_", "(_", "(_", "nod", "_", "._", "expr_", ",_", "lock", "ey_", ")_", ")_", "\\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_", "(_", "symbol_", ",_", "lock", "ey_", ")_", "in_", "self_", "._", "symbols", "used_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "symbol_", "._", "isi", "denti", "fier", "_", "(_", ")_", ":_", "\\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 ", " ", "_", "ast_", "._", "parse_", "(_", "symbol_", ")_", "\\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_", "(_", "'", "Warn", "ing", ":", " ", "code", " ", "snippet", " ", "\"%", "s", "\"", " ", "in", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "parse", ".'_", "%_", "(_", "symbol_", ",_", "lock", "ey_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lock", "ey_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loc_", "=_", "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 ", " _", "loc_", "=_", "self_", "._", "locations_", "[_", "lock", "ey_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "loc_", "and_", "symbol_", "in_", "loc_", "._", "props_", ":_", "\\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_", "symbol_", "in_", "self_", "._", "props_", ":_", "\\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_", "print_", "(_", "'", "Warn", "ing", ":", " ", "symbol", " ", "\"%", "s", "\"", " ", "in", " ", "%", "s", " ", "is", " ", "not", " ", "defin", "ed", ".'_", "%_", "(_", "symbol_", ",_", "lock", "ey_", ",_", ")_", ")_", "\\u\\u\\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_", "Location_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Location_", "(_", "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_", ",_", "name_", ",_", "key_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "key_", "=_", "slug", "gif", "y_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "loci", "d_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "props_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "prop", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Location_", "(_", "object_", ")_", ":_", "\\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_", "'<", "Locat", "ion", " ", "%", "s", ":", " ", "\"%", "s", "\">'_", "%_", "(_", "self_", "._", "key_", ",_", "self_", "._", "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_", "def_", "parse", "\\u", "world_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "world_", "=_", "World_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curl", "oc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curp", "rop_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fl_", "=_", "open_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ln_", "=_", "fl_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ln_", ":_", "\\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_", "ln_", "=_", "ln_", "._", "rstrip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "isin", "dent_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "ln_", "._", "lstrip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "val_", ")_", "<_", "len_", "(_", "ln_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "isin", "dent_", "=_", "len_", "(_", "ln_", ")_", "-_", "len_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ln_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "ln_", "or_", "ln_", "._", "startswith_", "(_", "'#'_", ")_", ":_", "\\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_", "ln_", "._", "startswith_", "(_", "'**", "*'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ln_", "._", "startswith_", "(_", "'*'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "New", " ", "location", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curp", "rop_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lock", "ey_", ",_", "dummy_", ",_", "loc", "name_", "=_", "ln_", "[_", "1_", ":_", "]_", "._", "partition_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lock", "ey_", "=_", "lock", "ey_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "name_", "=_", "loc", "name_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "loc", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loc", "name_", "=_", "lock", "ey_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lock", "ey_", "=_", "slug", "gif", "y_", "(_", "loc", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lock", "ey_", "in_", "world_", "._", "locations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Locat", "ion", " ", "defin", "ed", " ", "twi", "ce", ":", " ", "%", "s", "'_", "%_", "(_", "lock", "ey_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "curl", "oc_", "=_", "Location_", "(_", "loc", "name_", ",_", "lock", "ey_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "world_", "._", "locations_", "[_", "lock", "ey_", "]_", "=_", "curl", "oc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "world_", "._", "location", "list_", "._", "append_", "(_", "lock", "ey_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curp", "rop_", "=_", "'", "desc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isin", "dent_", "and_", "curp", "rop_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", " ", "Fail", "s", " ", "to", " ", "handle", " ", "extend", "ing", " ", "player", " ", "props_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "curl", "oc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "curp", "rop_", "not_", "in_", "world_", "._", "prop", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "world_", "._", "prop", "list_", "._", "append_", "(_", "curp", "rop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "append", "\\u", "to", "\\u", "prop_", "(_", "world_", "._", "props_", ",_", "curp", "rop_", ",_", "ln_", ",_", "indent_", "=_", "isin", "dent_", ")_", "\\u\\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_", "curp", "rop_", "not_", "in_", "curl", "oc_", "._", "prop", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "curl", "oc_", "._", "prop", "list_", "._", "append_", "(_", "curp", "rop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "append", "\\u", "to", "\\u", "prop_", "(_", "curl", "oc_", "._", "props_", ",_", "curp", "rop_", ",_", "ln_", ",_", "indent_", "=_", "isin", "dent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", ",_", "dummy_", ",_", "val_", "=_", "ln_", "._", "partition_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "dummy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Line", " ", "doe", "s", " ", "not", " ", "defin", "e", " ", "a", " ", "property", ":", " ", "%", "s", "'_", "%_", "(_", "ln_", "[_", ":_", "36_", "]_", ",_", ")_", ")_", "\\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_", "key_", "=_", "key_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "val_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "curl", "oc_", "and_", "key_", "._", "startswith_", "(_", "'$'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curp", "rop_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "==_", "'$", "wid", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "world_", "._", "wid_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'$", "name", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "world_", "._", "name_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'$", "creat", "or", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "world_", "._", "creator_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'$", "copy", "able", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "world_", "._", "copy", "able_", "=_", "not_", "(_", "val_", "._", "lower_", "(_", ")_", "[_", "0_", "]_", "in_", "[_", "'", "0", "'_", ",_", "'", "n", "'_", ",_", "'", "f", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'$", "instan", "cing", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "world_", "._", "instan", "cing", "_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", "not_", "in_", "(_", "'", "shared", "'_", ",_", "'", "solo", "'_", ",_", "'", "standard", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "error_", "(_", "'$", "instan", "cing", " ", "value", " ", "must", " ", "be", " ", "shared", ",", " ", "solo", ",", " ", "or", " ", "standard", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "._", "startswith_", "(_", "'$", "player", ".'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "key_", "[_", "8_", ":_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prop", "val_", "=_", "parse", "\\u", "prop_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "in_", "world_", "._", "player", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "error_", "(_", "'", "Player", " ", "key", " ", "defin", "ed", " ", "twi", "ce", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "world_", "._", "player", "props_", "[_", "key_", "]_", "=_", "prop", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "world_", "._", "player", "prop", "list_", "._", "append_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curp", "rop_", "=_", "key_", "\\u\\u\\uNEWLINE\\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 ", " _", "error_", "(_", "'", "Un", "know", "n", " ", "$", "key", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "key_", "._", "isi", "denti", "fier", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Proper", "ty", " ", "key", " ", "is", " ", "not", " ", "valid", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prop", "val_", "=_", "parse", "\\u", "prop_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "curl", "oc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "in_", "world_", "._", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Wor", "ld", " ", "key", " ", "defin", "ed", " ", "twi", "ce", ":", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "world_", "._", "props_", "[_", "key_", "]_", "=_", "prop", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "world_", "._", "prop", "list_", "._", "append_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curp", "rop_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "in_", "curl", "oc_", "._", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Locat", "ion", " ", "key", " ", "defin", "ed", " ", "twi", "ce", " ", "in", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "curl", "oc_", "._", "key_", ",_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "curl", "oc_", "._", "props_", "[_", "key_", "]_", "=_", "prop", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curl", "oc_", "._", "prop", "list_", "._", "append_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curp", "rop_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fl_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "world_", "._", "check", "\\u", "symbols", "\\u", "used_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "world_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "prop_", "(_", "prop_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "prop_", "._", "startswith_", "(_", "'*'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", ",_", "dummy_", ",_", "val_", "=_", "prop_", "[_", "1_", ":_", "]_", "._", "partition_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "val_", "and_", "key_", "not_", "in_", "(_", "'", "code", "'_", ",_", "'", "gent", "ext", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'%", "s", " ", "must", " ", "be", " ", "followe", "d", " ", "by", " ", "a", " ", "value", "'_", "%_", "(_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", "==_", "'", "port", "list", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plist", "key_", ",_", "dummy_", ",_", "val_", "=_", "val_", "._", "partition_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "{_", "'", "type", "'_", ":_", "'", "port", "list", "'_", ",_", "'", "plist", "key", "'_", ":_", "plist", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "templ", "ist", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "single", "'_", "in_", "val_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "[_", "'", "foc", "us", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", "==_", "'", "move", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "slug", "gif", "y_", "(_", "val_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "'", "type", "'_", ":_", "'", "move", "'_", ",_", "'", "loc", "'_", ":_", "val_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "foc", "us", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "slug", "gif", "y_", "(_", "val_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "'", "type", "'_", ":_", "'", "foc", "us", "'_", ",_", "'", "key", "'_", ":_", "val_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "event", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "type", "'_", ":_", "'", "event", "'_", ",_", "'", "text", "'_", ":_", "val_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "pani", "c", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "type", "'_", ":_", "'", "pani", "c", "'_", ",_", "'", "text", "'_", ":_", "val_", "}_", "#", " ", "theore", "tica", "ll", "y", " ", "the", " ", "text", " ", "is", " ", "optional_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "text", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", ",_", "'", "text", "'_", ":_", "val_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "gent", "ext", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "type", "'_", ":_", "'", "gent", "ext", "'_", ",_", "'", "text", "'_", ":_", "val_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "code", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "type", "'_", ":_", "'", "code", "'_", ",_", "'", "text", "'_", ":_", "val_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "self", "desc", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "type", "'_", ":_", "'", "self", "desc", "'_", ",_", "'", "text", "'_", ":_", "val_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "edits", "tr", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "type", "'_", ":_", "'", "edits", "tr", "'_", ",_", "'", "key", "'_", ":_", "val_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "datetime", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "val_", ",_", "'%", "Y", "-%", "m", "-%", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "datetime_", "._", "datetime_", "(_", "year_", "=_", "val_", "._", "year_", ",_", "month_", "=_", "val_", "._", "month_", ",_", "day_", "=_", "val_", "._", "day_", ",_", "tzinfo_", "=_", "datetime_", "._", "timezone_", "._", "utc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Un", "know", "n", " ", "special", " ", "property", " ", "type", ":", " ", "*", "%", "s", "'_", "%_", "(_", "key_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\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_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prop", "val_", "=_", "ast_", "._", "literal", "\\u", "eval_", "(_", "prop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "test", "-", "encode", " ", "the", " ", "new", " ", "value", " ", "to", " ", "bso", "n", ",", " ", "so", " ", "tha", "t", " ", "we", " ", "can", " ", "be", " ", "strict_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "catch", " ", "error", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "dummy_", "=_", "bson_", "._", "BS", "ON_", "._", "encode_", "(_", "{_", "'", "val", "'_", ":_", "prop", "val_", "}_", ",_", "check", "\\u", "keys_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "prop", "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_", "return_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", ",_", "'", "text", "'_", ":_", "prop_", "}_", "\\u\\u\\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_", "append", "\\u", "to", "\\u", "prop_", "(_", "dic_", ",_", "key_", ",_", "ln_", ",_", "indent_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "dic_", "._", "get_", "(_", "key_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", ",_", "'", "text", "'_", ":_", "ln_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic_", "[_", "key_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "val_", ")_", "is_", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "+=_", "(_", "'\\\\", "n", "\\\\", "n", "'_", "+_", "ln_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic_", "[_", "key_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "val_", ")_", "is_", "dict_", "and_", "ln_", "._", "startswith_", "(_", "'-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subkey", "_", ",_", "dummy_", ",_", "subv", "al_", "=_", "ln_", "[_", "1_", ":_", "]_", "._", "partition_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "dummy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Continu", "ation", " ", "*", "line", " ", "must", " ", "contain", " ", "a", " ", "colon", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subkey", "_", "=_", "subkey", "_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subv", "al_", "=_", "subv", "al_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", "._", "get_", "(_", "'", "type", "'_", ",_", "None_", ")_", "==_", "'", "port", "list", "'_", "and_", "subkey", "_", "==_", "'", "portal", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subl", "s_", "=_", "[_", "s2", "val_", "._", "strip_", "(_", ")_", "for_", "s2", "val_", "in_", "subv", "al_", "._", "split_", "(_", "','_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "subl", "s_", ")_", "!=_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Porta", "l", " ", "property", " ", "must", " ", "have", " ", "four", " ", "fields", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "[_", "'\\u", "templ", "ist", "'_", "]_", "._", "append_", "(_", "subl", "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 ", " _", "val_", "[_", "subkey", "_", "]_", "=_", "subv", "al_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "val_", ")_", "is_", "dict_", "and_", "val_", "._", "get_", "(_", "'", "type", "'_", ",_", "None_", ")_", "in_", "(_", "'", "code", "'_", ",_", "'", "gent", "ext", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'\\u", "base", "indent", "'_", "not_", "in_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "[_", "'\\u", "base", "indent", "'_", "]_", "=_", "indent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "indent", "str_", "=_", "'", " ", " ", "'_", "*_", "(_", "indent_", "-_", "val_", "[_", "'\\u", "base", "indent", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "val_", "[_", "'", "text", "'_", "]_", "._", "strip_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "[_", "'", "text", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "indent", "str_", "=_", "'\\\\", "n", "'_", "+_", "indent", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "[_", "'", "text", "'_", "]_", "+=_", "(_", "indent", "str_", "+_", "ln_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "val_", ")_", "is_", "dict_", "and_", "'", "text", "'_", "in_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Cover", "s", " ", "{", "text", "},", " ", "{", "event", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "[_", "'", "text", "'_", "]_", "+=_", "(_", "'\\\\", "n", "\\\\", "n", "'_", "+_", "ln_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Cann", "ot", " ", "append", " ", "to", " ", "property", " ", "%", "s", "'_", "%_", "(_", "key_", ",_", ")_", ")_", "\\u\\u\\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_", "transform", "\\u", "prop_", "(_", "world_", ",_", "db_", ",_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "val_", ")_", "is_", "not_", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", "=_", "val_", "._", "get_", "(_", "'", "type", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "key_", "==_", "'", "edits", "tr", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "edita", "ccess", "'_", "in_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "[_", "'", "edita", "ccess", "'_", "]_", "=_", "tw", "common_", "._", "access_", "._", "level", "\\u", "named_", "(_", "val_", "[_", "'", "edita", "ccess", "'_", "]_", ")_", "\\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_", "key_", "==_", "'", "port", "list", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "val_", "[_", "'", "plist", "key", "'_", "]_", "in_", "world_", "._", "port", "list", "map_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plist", "id_", "=_", "world_", "._", "port", "list", "map_", "[_", "val_", "[_", "'", "plist", "key", "'_", "]_", "]_", "[_", "'\\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 ", " _", "plist", "id_", "=_", "db_", "._", "port", "lists_", "._", "insert_", "(_", "{_", "'", "type", "'_", ":_", "'", "world", "'_", ",_", "'", "wid", "'_", ":_", "world_", "._", "wid_", ",_", "'", "key", "'_", ":_", "val_", "[_", "'", "plist", "key", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Creat", "ed", " ", "port", "list", " ", "%", "s", " ", "(%", "s", ")'_", "%_", "(_", "val_", "[_", "'", "plist", "key", "'_", "]_", ",_", "plist", "id_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Clean", " ", "out", " ", "the", " ", "port", "list", " ", "and", " ", "rebu", "ild", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "portal", "s_", "._", "remove_", "(_", "{_", "'", "plist", "id", "'_", ":_", "plist", "id_", ",_", "'", "iid", "'_", ":_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "pos_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "porti", "d_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "quad_", "in_", "val_", "[_", "'\\u", "templ", "ist", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "toc", "rea", "tor_", "=_", "db_", "._", "players_", "._", "find", "\\u", "one_", "(_", "{_", "'", "name", "'_", ":_", "quad_", "[_", "1_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "toc", "rea", "tor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Creat", "or", " ", "not", " ", "found", " ", "for", " ", "portal", ":", " ", "%", "s", ",", " ", "%", "s", "'_", "%_", "(_", "quad_", "[_", "0_", "]_", ",_", "quad_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'[", "Porta", "l", " ", "world", " ", "creat", "or", " ", "not", " ", "found", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tow", "orl", "d_", "=_", "db_", "._", "world", "s_", "._", "find", "\\u", "one_", "(_", "{_", "'", "name", "'_", ":_", "quad_", "[_", "0_", "]_", ",_", "'", "creat", "or", "'_", ":_", "toc", "rea", "tor_", "[_", "'\\u", "id", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "tow", "orl", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Wor", "ld", " ", "not", " ", "found", " ", "for", " ", "portal", ":", " ", "%", "s", "'_", "%_", "(_", "quad_", "[_", "0_", "]_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'[", "Porta", "l", " ", "world", " ", "not", " ", "found", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tol", "oc_", "=_", "db_", "._", "locations_", "._", "find", "\\u", "one_", "(_", "{_", "'", "wid", "'_", ":_", "tow", "orl", "d_", "[_", "'\\u", "id", "'_", "]_", ",_", "'", "key", "'_", ":_", "quad_", "[_", "3_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "tol", "oc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "(_", "'", "Locat", "ion", " ", "not", " ", "found", " ", "for", " ", "portal", ":", " ", "%", "s", ",", " ", "%", "s", "'_", "%_", "(_", "quad_", "[_", "0_", "]_", ",_", "quad_", "[_", "3_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'[", "Porta", "l", " ", "location", " ", "not", " ", "found", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query_", "=_", "{_", "'", "plist", "id", "'_", ":_", "plist", "id_", ",_", "'", "iid", "'_", ":_", "None_", ",_", "'", "wid", "'_", ":_", "tow", "orl", "d_", "[_", "'\\u", "id", "'_", "]_", ",_", "'", "loci", "d", "'_", ":_", "tol", "oc_", "[_", "'\\u", "id", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "quad_", "[_", "2_", "]_", "in_", "(_", "'", "persona", "l", "'_", ",_", "'", "global", "'_", ",_", "'", "same", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "[_", "'", "sci", "d", "'_", "]_", "=_", "quad_", "[_", "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 ", " _", "query_", "[_", "'", "sci", "d", "'_", "]_", "=_", "Object", "Id_", "(_", "quad_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query_", "[_", "'", "list", "pos", "'_", "]_", "=_", "list", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "pos_", "+=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "porti", "d_", "=_", "db_", "._", "portal", "s_", "._", "insert_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Creat", "ed", " ", "portal", " ", "%", "s", " ", "(%", "s", ")'_", "%_", "(_", "quad_", ",_", "porti", "d_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newval", "_", "=_", "{_", "'", "type", "'_", ":_", "'", "port", "list", "'_", ",_", "'", "plist", "key", "'_", ":_", "val_", "[_", "'", "plist", "key", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "text", "'_", "in_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newval", "_", "[_", "'", "text", "'_", "]_", "=_", "val_", "[_", "'", "text", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "foc", "us", "'_", "in_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newval", "_", "[_", "'", "foc", "us", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "edita", "ccess", "'_", "in_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newval", "_", "[_", "'", "edita", "ccess", "'_", "]_", "=_", "tw", "common_", "._", "access_", "._", "level", "\\u", "named_", "(_", "val_", "[_", "'", "edita", "ccess", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "reada", "ccess", "'_", "in_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newval", "_", "[_", "'", "reada", "ccess", "'_", "]_", "=_", "tw", "common_", "._", "access_", "._", "level", "\\u", "named_", "(_", "val_", "[_", "'", "reada", "ccess", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "newval", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prop", "\\u", "to", "\\u", "string_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "val_", ")_", "is_", "not_", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "repr_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", "=_", "val_", "._", "get_", "(_", "'", "type", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "==_", "'", "move", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'*", "move", " ", "%", "s", "'_", "%_", "(_", "val_", "[_", "'", "loc", "'_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", "==_", "'", "foc", "us", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'*", "foc", "us", " ", "%", "s", "'_", "%_", "(_", "val_", "[_", "'", "key", "'_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", "==_", "'", "event", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "'*", "event", " ", "%", "s", "'_", "%_", "(_", "val_", "[_", "'", "text", "'_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "ote", "xt", "'_", "in_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "(_", "'\\\\", "n", "\\\\", "t", "-", " ", "ote", "xt", ":", " ", "'_", "+_", "val_", "[_", "'", "ote", "xt", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", "==_", "'", "pani", "c", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "'*", "pani", "c", " ", "%", "s", "'_", "%_", "(_", "val_", "[_", "'", "text", "'_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "ote", "xt", "'_", "in_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "(_", "'\\\\", "n", "\\\\", "t", "-", " ", "ote", "xt", ":", " ", "'_", "+_", "val_", "[_", "'", "ote", "xt", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", "==_", "'", "self", "desc", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "'*", "self", "desc", " ", "%", "s", "'_", "%_", "(_", "val_", "[_", "'", "text", "'_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", "==_", "'", "text", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "val_", "[_", "'", "text", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'\\\\", "n", "\\\\", "n", "'_", "in_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "val_", "._", "replace_", "(_", "'\\\\", "n", "\\\\", "n", "'_", ",_", "'\\\\", "n", "\\\\", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", "==_", "'", "gent", "ext", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "val_", "[_", "'", "text", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'\\\\", "n", "'_", "not_", "in_", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'*", "gent", "ext", " ", "%", "s", "'_", "%_", "(_", "text_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ls_", "=_", "[_", "'", " ", " ", "'_", "+_", "val_", "for_", "val_", "in_", "text_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'*", "gent", "ext", "\\\\", "n", "%", "s", "'_", "%_", "(_", "text_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", "==_", "'", "code", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "val_", "[_", "'", "text", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'\\\\", "n", "'_", "not_", "in_", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'*", "code", " ", "%", "s", "'_", "%_", "(_", "text_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ls_", "=_", "[_", "'", " ", " ", "'_", "+_", "val_", "for_", "val_", "in_", "text_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'*", "code", "\\\\", "n", "%", "s", "'_", "%_", "(_", "text_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "repr_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "interp", "\\u", "text_", "(_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", " ", "events", " ", "als", "o", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "type_", "(_", "res_", ")_", "is_", "dict_", "and_", "res_", "._", "get_", "(_", "'", "type", "'_", ",_", "None_", ")_", "==_", "'", "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_", "is", "\\u", "code_", "(_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "type_", "(_", "res_", ")_", "is_", "dict_", "and_", "res_", "._", "get_", "(_", "'", "type", "'_", ",_", "None_", ")_", "==_", "'", "code", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "move_", "(_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "type_", "(_", "res_", ")_", "is_", "dict_", "and_", "res_", "._", "get_", "(_", "'", "type", "'_", ",_", "None_", ")_", "==_", "'", "move", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "error_", "(_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "error", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "count_", "=_", "error", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Error", ":", " ", "%", "s", "'_", "%_", "(_", "msg_", ",_", ")_", ")_", "\\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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
douban/python-libmemcached/benchmark.py
[ { "content": " def test_set(self):\n set_ = self.mc.set\n pairs = zip(self.keys, self.values)\n\n def test():\n for key, value in pairs:\n set_(key, value)\n def test_loop():\n for i in range(10):\n for key, value in pairs:\n set_(key, value)\n run_test(test, 'test_set')\n\n for key, value in pairs:\n self.mc.delete(key)", "metadata": "root.Benchmark.test_set", "header": "['class', 'Benchmark', '(', 'object', ')', ':', '___EOS___']", "index": 65 }, { "content": " def test_random_get(self):\n get_ = self.mc.get\n set_ = self.mc.set\n\n value = \"chenyin\"\n\n def test():\n index = 0\n for key in self.random_keys:\n result = get_(key)\n index += 1\n if(index % 5 == 0):\n set_(key, value)\n run_test(test, 'test_random_get')", "metadata": "root.Benchmark.test_random_get", "header": "['class', 'Benchmark', '(', 'object', ')', ':', '___EOS___']", "index": 96 }, { "content": " def test_set_same(self):\n set_ = self.mc.set\n\n def test():\n for i in xrange(self.options.num_tests):\n set_('key', 'value')\n def test_loop():\n for i in range(10):\n for i in xrange(self.options.num_tests):\n set_('key', 'value')\n run_test(test, 'test_set_same')\n\n self.mc.delete('key')", "metadata": "root.Benchmark.test_set_same", "header": "['class', 'Benchmark', '(', 'object', ')', ':', '___EOS___']", "index": 111 } ]
[ { "span": "test_loop(", "start_line": 72, "start_column": 12, "end_line": 72, "end_column": 21 }, { "span": "result ", "start_line": 105, "start_column": 16, "end_line": 105, "end_column": 22 }, { "span": "test_loop(", "start_line": 117, "start_column": 12, "end_line": 117, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Benchmark", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "_", "=_", "self_", "._", "mc_", "._", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pairs_", "=_", "zip_", "(_", "self_", "._", "keys_", ",_", "self_", "._", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "value_", "in_", "pairs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "loop_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "value_", "in_", "pairs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "set\\u", "_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run", "\\u", "test_", "(_", "test_", ",_", "'", "test\\u", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "pairs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mc_", "._", "delete_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Benchmark", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "random", "\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u_", "=_", "self_", "._", "mc_", "._", "get_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "_", "=_", "self_", "._", "mc_", "._", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "\"", "chen", "yin", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "self_", "._", "random", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "get", "\\u_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "index_", "%_", "5_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "set\\u", "_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run", "\\u", "test_", "(_", "test_", ",_", "'", "test\\u", "random", "\\u", "get", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Benchmark", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "set\\u", "same_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "_", "=_", "self_", "._", "mc_", "._", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "self_", "._", "options_", "._", "num", "\\u", "tests_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "_", "(_", "'", "key", "'_", ",_", "'", "value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "loop_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "self_", "._", "options_", "._", "num", "\\u", "tests_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "set\\u", "_", "(_", "'", "key", "'_", ",_", "'", "value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run", "\\u", "test_", "(_", "test_", ",_", "'", "test\\u", "set\\u", "same", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mc_", "._", "delete_", "(_", "'", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
redhat-cip/software-factory/tests/functional/test_userdata.py
[ { "content": " @skipIfIssueTrackerMissing()\n def test_nonmember_backlog_permissions(self):\n \"\"\"Make sure project non members can see the backlog and add\n stories\"\"\"\n # default value, skip gracefully if it cannot be found\n try:\n non_member_role = self.rm.get_role(1)\n assert non_member_role.name == 'Non member'\n except:\n self.skipTest(\"Could not fetch non-member permissions\")\n self.assertTrue('view_master_backlog' in non_member_role.permissions)\n self.assertTrue('create_stories' in non_member_role.permissions)", "metadata": "root.TestUserdata.test_nonmember_backlog_permissions", "header": "['class', 'TestUserdata', '(', 'Base', ')', ':', '___EOS___']", "index": 139 } ]
[ { "span": "except:", "start_line": 147, "start_column": 8, "end_line": 147, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "User", "data_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "skip", "If", "Issue", "Track", "er", "Missing", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "non", "member", "\\u", "backlog", "\\u", "permissions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Make", " ", "sure", " ", "project", " ", "non", " ", "member", "s", " ", "can", " ", "see", " ", "the", " ", "backlog", " ", "and", " ", "add", "\\", "10", ";", " ", " ", " ", " ", "stories", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "default", " ", "value", ",", " ", "skip", " ", "graceful", "ly", " ", "if", " ", "it", " ", "cann", "ot", " ", "be", " ", "found_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "non", "\\u", "member", "\\u", "role_", "=_", "self_", "._", "rm_", "._", "get", "\\u", "role_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "non", "\\u", "member", "\\u", "role_", "._", "name_", "==_", "'", "Non", " ", "member", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "skip", "Test_", "(_", "\"", "Cou", "ld", " ", "not", " ", "fetch", " ", "non", "-", "member", " ", "permissi", "ons", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "view", "\\u", "master", "\\u", "backlog", "'_", "in_", "non", "\\u", "member", "\\u", "role_", "._", "permissions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "create", "\\u", "stories", "'_", "in_", "non", "\\u", "member", "\\u", "role_", "._", "permissions_", ")_", "\\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, 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 ]
Wrong number of arguments in a call
davidhalter/jedi/test/completion/docstring.py
[ { "content": "\"\"\" Test docstrings in functions and classes, which are used to infer types \"\"\"\n\n# -----------------\n# sphinx style\n# -----------------\n\n#? dict()\nsphinxy()\n\n# wrong declarations\n\n#? \nsphinxy2()\n\n# local classes -> github #370\n\n\n\n\n\n\n\n\n# sphinx returns\n\n#? ['seed']\nreturn_module_object().seed\n\n\n# -----------------\n# epydoc style\n# -----------------\n\n#? list()\nepydoc()\n\n\n# Returns with param type only\n\n#? str()\nrparam()\n\n\n# Composite types\n\nx, y, z = composite()\n#? str()\nx\n#? int()\ny\n#? dict()\nz\n\n\n# Both docstring and calculated return type\n\n#? str() int()\nboth()\n\n\n# -----------------\n# statement docstrings\n# -----------------\nd = ''\n\"\"\" bsdf \"\"\"\n#? str()\nd.upper()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def sphinxy(a, b, c, d, x):\n \"\"\" asdfasdf\n :param a: blablabla\n :type a: str\n :type b: (str, int)\n :type c: random.Random\n :type d: :class:`random.Random`\n :param str x: blablabla\n :rtype: dict\n \"\"\"\n #? str()\n a\n #? str()\n b[0]\n #? int()\n b[1]\n #? ['seed']\n c.seed\n #? ['seed']\n d.seed\n #? ['lower']\n x.lower", "metadata": "root.sphinxy", "header": "['module', '___EOS___']", "index": 5 }, { "content": "def sphinxy2(a, b, x):\n \"\"\"\n :param a: Forgot type declaration\n :type a:\n :param b: Just something\n :type b: ``\n :param x: Just something without type\n :rtype:\n \"\"\"\n #? \n a\n #? \n b\n #?\n x", "metadata": "root.sphinxy2", "header": "['module', '___EOS___']", "index": 32 }, { "content": "def return_module_object():\n \"\"\"\n :rtype: :class:`random.Random`\n \"\"\"", "metadata": "root.return_module_object", "header": "['module', '___EOS___']", "index": 94 }, { "content": "def epydoc(a, b):\n \"\"\" asdfasdf\n @type a: str\n @param a: blablabla\n @type b: (str, int)\n @param b: blablah\n @rtype: list\n \"\"\"\n #? str()\n a\n #? str()\n b[0]\n\n #? int()\n b[1]", "metadata": "root.epydoc", "header": "['module', '___EOS___']", "index": 106 }, { "content": "def rparam(a,b):\n \"\"\"\n @type a: str\n \"\"\"\n return a", "metadata": "root.rparam", "header": "['module', '___EOS___']", "index": 127 }, { "content": "def composite():\n \"\"\"\n @rtype: (str, int, dict)\n \"\"\"", "metadata": "root.composite", "header": "['module', '___EOS___']", "index": 138 }, { "content": "def both():\n \"\"\"\n @rtype: str\n \"\"\"\n return 23", "metadata": "root.both", "header": "['module', '___EOS___']", "index": 153 } ]
[ { "span": "sphinxy()", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 9 }, { "span": "sphinxy2()", "start_line": 49, "start_column": 0, "end_line": 49, "end_column": 10 }, { "span": "epydoc()", "start_line": 123, "start_column": 0, "end_line": 123, "end_column": 8 }, { "span": "rparam()", "start_line": 134, "start_column": 0, "end_line": 134, "end_column": 8 } ]
[ { "span": "def sphinxy(a, b, c, d, x):", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 27 }, { "span": "def sphinxy2(a, b, x):", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 22 }, { "span": "def epydoc(a, b):", "start_line": 106, "start_column": 0, "end_line": 106, "end_column": 17 }, { "span": "def rparam(a,b):", "start_line": 127, "start_column": 0, "end_line": 127, "end_column": 16 } ]
1
false
[ "[CLS]_", "Wro", "ng_", "number_", "of_", "arguments_", "in_", "a_", "call_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", " ", "Test", " ", "docstrings", " ", "in", " ", "function", "s", " ", "and", " ", "classe", "s", ",", " ", "whi", "ch", " ", "are", " ", "used", " ", "to", " ", "infer", " ", "types", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", " ", "style_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "?", " ", "dict", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sphinx", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wrong", " ", "declarations_", "\\u\\u\\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_", "sphinx", "y2_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "local", " ", "classe", "s", " ", "->", " ", "git", "hub", " ", "#", "370", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "sphinx", " ", "returns_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "?", " ", "['", "seed", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return", "\\u", "module", "\\u", "object_", "(_", ")_", "._", "seed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ep", "ydo", "c", " ", "style_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "?", " ", "list", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ep", "ydo", "c_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", "s", " ", "with", " ", "param", " ", "type", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "?", " ", "str", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rpa", "ram_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Composit", "e", " ", "types_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x_", ",_", "y_", ",_", "z_", "=_", "composite_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "?", " ", "str", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "?", " ", "int", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "?", " ", "dict", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bot", "h", " ", "docstr", "ing", " ", "and", " ", "calculated", " ", "return", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "?", " ", "str", "()", " ", "int", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "both_", "(_", ")_", "\\u\\u\\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_", "#", " ", "statem", "ent", " ", "docstrings", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", " ", "bsd", "f", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "?", " ", "str", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "upper_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "sphinx", "y_", "(_", "a_", ",_", "b_", ",_", "c_", ",_", "d_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "asd", "fas", "df", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "a", ":", " ", "bla", "bla", "bla", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "a", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "b", ":", " ", "(", "str", ",", " ", "int", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "c", ":", " ", "random", ".", "Random", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "d", ":", " ", ":", "class", ":`", "random", ".", "Random", "`", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "str", " ", "x", ":", " ", "bla", "bla", "bla", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "?", " ", "str", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "?", " ", "str", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "?", " ", "int", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "?", " ", "['", "seed", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "seed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "?", " ", "['", "seed", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "seed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "?", " ", "['", "lower", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "._", "lower_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "sphinx", "y2_", "(_", "a_", ",_", "b_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "a", ":", " ", "Forg", "ot", " ", "type", " ", "declaration", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "a", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "b", ":", " ", "Ju", "st", " ", "somet", "hing", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "b", ":", " ", "``", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "x", ":", " ", "Ju", "st", " ", "somet", "hing", " ", "with", "out", " ", "type", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "?", " _", "\\u\\u\\uNL\\u\\u\\u_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "?", " _", "\\u\\u\\uNL\\u\\u\\u_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "return", "\\u", "module", "\\u", "object_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", "random", ".", "Random", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "ep", "ydo", "c_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "asd", "fas", "df", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "a", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "a", ":", " ", "bla", "bla", "bla", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "b", ":", " ", "(", "str", ",", " ", "int", ")", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", ":", " ", "bla", "bla", "h", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "?", " ", "str", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "?", " ", "str", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "?", " ", "int", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "rpa", "ram_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "a", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "composite_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "(", "str", ",", " ", "int", ",", " ", "dict", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "both_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "23_", "\\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, 0, 1, 1, 1, 1, 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, 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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, 4, 2, 2, 2, 3, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
ionyse/ionyweb/ionyweb/administration/views/users.py
[ { "content": " def post(self, request):\n\n if 'old_password' in request.POST and request.POST['old_password'] == \"\":\n userform = EditCurrentUser(request.user, request.POST)\n \n if userform.is_valid():\n userform.save(request.user)\n response = Response(status.HTTP_200_OK, {})\n return self.render(response)\n else:\n passform = PasswordChangeForm(request.user)\n html = render_to_string('administration/users/current-user.html',\n {'userform': userform,\n 'passform': passform,},\n context_instance = RequestContext(request))\n \n response = Response(status.HTTP_400_BAD_REQUEST, {\"html\": html})\n return self.render(response)\n \n else:\n userform = EditCurrentUser(request.user, request.POST)\n passform = PasswordChangeForm(request.user, data=request.POST)\n \n \n if userform.is_valid() and passform.is_valid():\n userform.save(request.user)\n passform.save(request.user)\n \n response = Response(status.HTTP_200_OK, {})\n return self.render(response)\n else:\n \n html = render_to_string('administration/users/current-user.html',\n {'userform': userform,\n 'passform': passform,},\n context_instance = RequestContext(request))\n response = Response(status.HTTP_400_BAD_REQUEST, {\"html\": html})\n return self.render(response)\n \n raise ErrorResponse(status.HTTP_400_BAD_REQUEST,\n {'msg': MESSAGES.get('default_error', \"\")})", "metadata": "root.CurrentUser.post", "header": "['class', 'CurrentUser', '(', 'IsAdminView', ')', ':', '___EOS___']", "index": 25 } ]
[ { "span": "raise ErrorResponse(status.HTTP_400_BAD_REQUEST,\n {'msg': MESSAGES.get('default_error', \"\")})", "start_line": 64, "start_column": 8, "end_line": 65, "end_column": 75 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Curr", "ent", "User_", "(_", "Is", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "old", "\\u", "password", "'_", "in_", "request_", "._", "POST_", "and_", "request_", "._", "POST_", "[_", "'", "old", "\\u", "password", "'_", "]_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "form_", "=_", "Edit", "Curr", "ent", "User_", "(_", "request_", "._", "user_", ",_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "form_", "._", "save_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "Response_", "(_", "status_", "._", "HTTP", "\\u", "200", "\\u", "OK_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "render_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass", "form_", "=_", "Passw", "ord", "Change", "Form_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "=_", "render", "\\u", "to", "\\u", "string_", "(_", "'", "administrati", "on", "/", "users", "/", "current", "-", "user", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "user", "form", "'_", ":_", "user", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pass", "form", "'_", ":_", "pass", "form_", ",_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "Response_", "(_", "status_", "._", "HTTP", "\\u", "400", "\\u", "BAD", "\\u", "REQUEST_", ",_", "{_", "\"", "html", "\"_", ":_", "html_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "render_", "(_", "response_", ")_", "\\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 ", " _", "user", "form_", "=_", "Edit", "Curr", "ent", "User_", "(_", "request_", "._", "user_", ",_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass", "form_", "=_", "Passw", "ord", "Change", "Form_", "(_", "request_", "._", "user_", ",_", "data_", "=_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user", "form_", "._", "is", "\\u", "valid_", "(_", ")_", "and_", "pass", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "form_", "._", "save_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass", "form_", "._", "save_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "Response_", "(_", "status_", "._", "HTTP", "\\u", "200", "\\u", "OK_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "render_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "=_", "render", "\\u", "to", "\\u", "string_", "(_", "'", "administrati", "on", "/", "users", "/", "current", "-", "user", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "user", "form", "'_", ":_", "user", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pass", "form", "'_", ":_", "pass", "form_", ",_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "Response_", "(_", "status_", "._", "HTTP", "\\u", "400", "\\u", "BAD", "\\u", "REQUEST_", ",_", "{_", "\"", "html", "\"_", ":_", "html_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "render_", "(_", "response_", ")_", "\\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_", "Error", "Response_", "(_", "status_", "._", "HTTP", "\\u", "400", "\\u", "BAD", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "msg", "'_", ":_", "MESSAGES_", "._", "get_", "(_", "'", "default", "\\u", "error", "'_", ",_", "\"\"_", ")_", "}_", ")_" ]
[ 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
jarus/fabric-gunicorn/fabfile.py
[ { "content": "from fabric.api import env\nimport fabric_gunicorn as gunicorn\n\nenv.host_string = 'thelabmill.de'\nenv.port = 22\nenv.user = 'christoph'\n\n#env.remote_workdir = '/home/christoph'\nenv.virtualenv_dir = env.remote_workdir + '/env'\n\nenv.gunicorn_wsgi_app = 'hello.wsgi:app'\n#env.gunicorn_pidfile = env.remote_workdir + '/test.pid'\n#env.gunicorn_bind = 'localhost:5000'\n#env.django_settings_module = 'test'\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import fabric_gunicorn as gunicorn", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "fabric_", "._", "api_", "import_", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "fab", "ric", "\\u", "gun", "icor", "n_", "as_", "gun", "icor", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "host", "\\u", "string_", "=_", "'", "thel", "ab", "mill", ".", "de", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "port_", "=_", "22_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "user_", "=_", "'", "chris", "top", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "env", ".", "remote", "\\u", "workdir", " ", "=", " ", "'/", "home", "/", "chris", "top", "h", "'_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "virtualenv", "\\u", "dir_", "=_", "env_", "._", "remote", "\\u", "workdir_", "+_", "'/", "env", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "gun", "icor", "n", "\\u", "wsgi", "\\u", "app_", "=_", "'", "hell", "o", ".", "wsgi", ":", "app", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "env", ".", "gun", "icor", "n", "\\u", "pid", "file", " ", "=", " ", "env", ".", "remote", "\\u", "workdir", " ", "+", " ", "'/", "test", ".", "pid", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "env", ".", "gun", "icor", "n", "\\u", "bind", " ", "=", " ", "'", "local", "host", ":", "5000", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "env", ".", "django", "\\u", "settings", "\\u", "module", " ", "=", " ", "'", "test", "'_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Missing call to `__init__` during object initialization
dimagi/commcare-hq/corehq/preindex/preindex_plugins.py
[ { "content": " def __init__(self, app_label, file):\n # once the fluff part of this has been merged we can get rid of this\n # this is just to make it easy for me in the meantime\n assert 'FluffPreindexPlugin' == self.__class__.__name__\n self.app_label = app_label\n self.dir = os.path.abspath(os.path.dirname(file))", "metadata": "root.PreindexPlugin.__init__", "header": "['class', 'PreindexPlugin', '(', 'object', ')', ':', '___EOS___']", "index": 60 }, { "content": "class CouchAppsPreindexPlugin(PreindexPlugin):\n \"\"\"\n :param app_label: The app label for the top level application.\n :param dir: The directory of the top level application.\n :param app_db_map: A dictionary mapping child apps to couch databases.\n e.g. {'my_app': 'meta'} will result in 'my_app' being synced\n to the '{main_db}__meta' database.\n\n use e.g.\n CouchAppsPreindexPlugin.register('couchapps', __file__, {\n 'myview': <list of db slugs to sync to>\n ...\n })\n to register a module as a couchapps root\n\n \"\"\"\n\n\n", "metadata": "root.CouchAppsPreindexPlugin", "header": "['module', '___EOS___']", "index": 78 }, { "content": " def __init__(self, app_label, file, app_db_map=None):\n self.app_label = app_label\n self.dir = os.path.abspath(os.path.dirname(file))\n self.app_db_map = app_db_map", "metadata": "root.CouchAppsPreindexPlugin.__init__", "header": "['class', 'CouchAppsPreindexPlugin', '(', 'PreindexPlugin', ')', ':', '___EOS___']", "index": 94 }, { "content": "class ExtraPreindexPlugin(PreindexPlugin):\n \"\"\"\n ExtraPreindexPlugin.register('myapp', __file__, <list of db slugs to sync to>)\n \"\"\"\n\n", "metadata": "root.ExtraPreindexPlugin", "header": "['module', '___EOS___']", "index": 115 }, { "content": " def __init__(self, app_label, file, db_names=None):\n self.app_label = app_label\n self.dir = os.path.abspath(os.path.dirname(file))\n self.db_names = db_names", "metadata": "root.ExtraPreindexPlugin.__init__", "header": "['class', 'ExtraPreindexPlugin', '(', 'PreindexPlugin', ')', ':', '___EOS___']", "index": 119 } ]
[ { "span": "class CouchAppsPreindexPlugin(PreindexPlugin):", "start_line": 78, "start_column": 0, "end_line": 78, "end_column": 46 }, { "span": "class ExtraPreindexPlugin(PreindexPlugin):", "start_line": 115, "start_column": 0, "end_line": 115, "end_column": 42 } ]
[ { "span": "def __init__(self, app_label, file):", "start_line": 60, "start_column": 4, "end_line": 60, "end_column": 40 }, { "span": "def __init__(self, app_label, file, app_db_map=None):", "start_line": 94, "start_column": 4, "end_line": 94, "end_column": 57 }, { "span": "def __init__(self, app_label, file, db_names=None):", "start_line": 119, "start_column": 4, "end_line": 119, "end_column": 55 } ]
1
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "class_", "Pre", "index", "Plugin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "app", "\\u", "label_", ",_", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "onc", "e", " ", "the", " ", "flu", "ff", " ", "part", " ", "of", " ", "this", " ", "has", " ", "bee", "n", " ", "merge", "d", " ", "we", " ", "can", " ", "get", " ", "rid", " ", "of", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "just", " ", "to", " ", "make", " ", "it", " ", "easy", " ", "for", " ", "me", " ", "in", " ", "the", " ", "mean", "time_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "'", "Flu", "ff", "Pre", "index", "Plug", "in", "'_", "==_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app", "\\u", "label_", "=_", "app", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dir_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Cou", "ch", "App", "s", "Pre", "index", "Plugin_", "(_", "Pre", "index", "Plugin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "app", "\\u", "label", ":", " ", " ", " ", "The", " ", "app", " ", "label", " ", "for", " ", "the", " ", "top", " ", "level", " ", "applica", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "dir", ":", " ", " ", " ", " ", " ", "The", " ", "director", "y", " ", "of", " ", "the", " ", "top", " ", "level", " ", "applica", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "app", "\\u", "db", "\\u", "map", ":", " ", " ", "A", " ", "dictionar", "y", " ", "mapping", " ", "child", " ", "apps", " ", "to", " ", "couch", " ", "databa", "ses", ".", "\\", "10", ";", " ", " ", "e", ".", "g", ".", " ", "{", "'", "my", "\\u", "app", "':", " ", "'", "meta", "'}", " ", "will", " ", "result", " ", "in", " ", "'", "my", "\\u", "app", "'", " ", "bei", "ng", " ", "synced", "\\", "10", ";", " ", " ", "to", " ", "the", " ", "'{", "main", "\\u", "db", "}\\u", "\\u", "meta", "'", " ", "databa", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "use", " ", "e", ".", "g", ".", "\\", "10", ";", " ", " ", " ", " ", "Cou", "ch", "App", "s", "Pre", "index", "Plug", "in", ".", "register", "('", "couch", "apps", "',", " ", "\\u\\u", "file", "\\u\\u", ",", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "'", "myv", "iew", "':", " ", "<", "list", " ", "of", " ", "db", " ", "slug", "s", " ", "to", " ", "sync", " ", "to", ">", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "})", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "register", " ", "a", " ", "module", " ", "as", " ", "a", " ", "couch", "apps", " ", "root", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cou", "ch", "App", "s", "Pre", "index", "Plugin_", "(_", "Pre", "index", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "app", "\\u", "label_", ",_", "file_", ",_", "app", "\\u", "db", "\\u", "map_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app", "\\u", "label_", "=_", "app", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dir_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app", "\\u", "db", "\\u", "map_", "=_", "app", "\\u", "db", "\\u", "map_", "\\u\\u\\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_", "Extra", "Pre", "index", "Plugin_", "(_", "Pre", "index", "Plugin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Extra", "Pre", "index", "Plug", "in", ".", "register", "('", "myapp", "',", " ", "\\u\\u", "file", "\\u\\u", ",", " ", "<", "list", " ", "of", " ", "db", " ", "slug", "s", " ", "to", " ", "sync", " ", "to", ">)", "\\", "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_", "[SEP]_", "class_", "Extra", "Pre", "index", "Plugin_", "(_", "Pre", "index", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "app", "\\u", "label_", ",_", "file_", ",_", "db", "\\u", "names_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app", "\\u", "label_", "=_", "app", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dir_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db", "\\u", "names_", "=_", "db", "\\u", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
aws/aws-cli/tests/functional/opsworks/test_create_stack.py
[ { "content": "#!/usr/bin/env python\n# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n# may not use this file except in compliance with the License. A copy of\n# the License is located at\n#\n# http://aws.amazon.com/apache2.0/\n#\n# or in the \"license\" file accompanying this file. This file is\n# distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n# ANY KIND, either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\nfrom awscli.testutils import BaseAWSCommandParamsTest\nimport os\nimport awscli.clidriver\n\n\n\n\nif __name__ == \"__main__\":\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestCreateStack(BaseAWSCommandParamsTest):\n\n prefix = 'opsworks create-stack'\n", "metadata": "root.TestCreateStack", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def test_attributes_file(self):\n cmdline = self.prefix\n cmdline += ' --service-role-arn arn-blahblahblah'\n cmdline += ' --name FooStack'\n cmdline += ' --stack-region us-west-2'\n cmdline += ' --default-instance-profile-arn arn-foofoofoo'\n result = {'ServiceRoleArn': 'arn-blahblahblah',\n 'Name': 'FooStack',\n 'Region': 'us-west-2',\n 'DefaultInstanceProfileArn': 'arn-foofoofoo'\n }\n self.assert_params_for_cmd(cmdline, result)", "metadata": "root.TestCreateStack.test_attributes_file", "header": "['class', 'TestCreateStack', '(', 'BaseAWSCommandParamsTest', ')', ':', '___EOS___']", "index": 22 } ]
[ { "span": "import os", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 9 }, { "span": "import awscli.clidriver", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", "-", "2013", " ", "Ama", "zon", ".", "com", ",", " ", "Inc", ".", " ", "or", " ", "its", " ", "affi", "liat", "es", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\")", ".", " ", "You", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "A", " ", "copy", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "License", " ", "is", " ", "located", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "aws", ".", "amaz", "on", ".", "com", "/", "apa", "che", "2.0", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "in", " ", "the", " ", "\"", "license", "\"", " ", "file", " ", "accom", "pan", "ying", " ", "this", " ", "file", ".", " ", "Thi", "s", " ", "file", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "from_", "aws", "cli_", "._", "testutils_", "import_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "aws", "cli_", "._", "cli", "driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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", "Creat", "e", "Stack_", "(_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "=_", "'", "ops", "works", " ", "create", "-", "stack", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Creat", "e", "Stack_", "(_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "attribute", "s", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmdline_", "=_", "self_", "._", "prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmdline_", "+=_", "'", " ", "--", "service", "-", "role", "-", "arn", " ", "arn", "-", "bla", "hb", "lah", "bla", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmdline_", "+=_", "'", " ", "--", "name", " ", "Foo", "Stack", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmdline_", "+=_", "'", " ", "--", "stack", "-", "region", " ", "us", "-", "west", "-", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmdline_", "+=_", "'", " ", "--", "default", "-", "instance", "-", "profile", "-", "arn", " ", "arn", "-", "foo", "foo", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "'", "Service", "Ro", "le", "Arn", "'_", ":_", "'", "arn", "-", "bla", "hb", "lah", "bla", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Name", "'_", ":_", "'", "Foo", "Stack", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Region", "'_", ":_", "'", "us", "-", "west", "-", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Default", "Insta", "nce", "Profil", "e", "Arn", "'_", ":_", "'", "arn", "-", "foo", "foo", "foo", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "\\u", "params", "\\u", "for", "\\u", "cmd_", "(_", "cmdline_", ",_", "result_", ")_", "\\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,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the window and returns the\n embedded scene inside it. This is useful from an IPython/vanilla\n Python shell. It returns the viewer window instance.\n\n Parameters\n ----------\n\n - browser : `bool` (default, True)\n\n If True, creates an IVTK scene with an embedded PipelineBrowser.\n If False, does not create it.\n\n - instantiate_gui : `bool` (default: False)\n\n If True, create an instance of GUI(). This is useful when this\n function is invoked from within an IPython shell. OTOH, if this\n is called from within a wxPython app (or with ipython --gui=qt)\n you don't want to start another GUI instance.\n \"\"\"\n if instantiate_gui:\n gui = GUI()\n if browser:\n v = IVTKWithBrowser(size=(600,600))\n else:\n v = IVTK(size=(600,600))\n v.open()\n return v", "metadata": "root.viewer", "header": "['module', '___EOS___']", "index": 450 } ]
[ { "span": "gui ", "start_line": 471, "start_column": 8, "end_line": 471, "end_column": 11 } ]
[]
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_", "viewer_", "(_", "browser_", "=_", "True_", ",_", "instantiate", "\\u", "gui_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "an", " ", "IV", "TK", " ", "instance", ",", " ", "opens", " ", "the", " ", "window", " ", "and", " ", "return", "s", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "embedde", "d", " ", "scen", "e", " ", "insi", "de", " ", "it", ".", " ", " ", "Thi", "s", " ", "is", " ", "usef", "ul", " ", "from", " ", "an", " ", "IP", "yth", "on", "/", "vanilla", "\\", "10", ";", " ", " ", " ", " ", "Pyth", "on", " ", "shell", ".", " ", " ", "It", " ", "return", "s", " ", "the", " ", "viewer", " ", "window", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "browse", "r", " ", ":", " ", "`", "bool", "`", " ", "(", "default", ",", " ", "Tru", "e", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", "If", " ", "Tru", "e", ",", " ", "create", "s", " ", "an", " ", "IV", "TK", " ", "scen", "e", " ", "with", " ", "an", " ", "embedde", "d", " ", "Pipe", "line", "Brows", "er", ".", "\\", "10", ";", " ", " ", "If", " ", "Fal", "se", ",", " ", "doe", "s", " ", "not", " ", "create", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "instantiate", "\\u", "gui", " ", ":", " ", "`", "bool", "`", " ", "(", "default", ":", " ", "Fal", "se", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", "If", " ", "Tru", "e", ",", " ", "create", " ", "an", " ", "instance", " ", "of", " ", "GU", "I", "()", ".", " ", " ", "Thi", "s", " ", "is", " ", "usef", "ul", " ", "whe", "n", " ", "this", "\\", "10", ";", " ", " ", "function", " ", "is", " ", "invoke", "d", " ", "from", " ", "within", " ", "an", " ", "IP", "yth", "on", " ", "shell", ".", " ", " ", "OT", "OH", ",", " ", "if", " ", "this", "\\", "10", ";", " ", " ", "is", " ", "call", "ed", " ", "from", " ", "within", " ", "a", " ", "wx", "Pyth", "on", " ", "app", " ", "(", "or", " ", "with", " ", "ipython", " ", "--", "gui", "=", "qt", ")", "\\", "10", ";", " ", " ", "you", " ", "don", "'", "t", " ", "want", " ", "to", " ", "start", " ", "anot", "her", " ", "GU", "I", " ", "instance", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "instantiate", "\\u", "gui_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gui_", "=_", "GUI_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "browser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "IV", "TK", "With", "Browser_", "(_", "size_", "=_", "(_", "600_", ",_", "600_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "IV", "TK", "_", "(_", "size_", "=_", "(_", "600_", ",_", "600_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "v_", "._", "open_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
Sage-Bionetworks/synapsePythonClient/synapseutils/copy.py
[ { "content": "def copy(syn, entity, destinationId=None, copyWikiPage=True, **kwargs):\n \"\"\"\n Copies synapse entities including the wikis\n\n :param entity: A synapse entity ID\n\n :param destinationId: Synapse ID of a folder/project that the copied entity is being copied to\n\n :param copyWikiPage: Determines whether the wiki of the entity is copied over\n Default is True\n\n :param copyTable: Determines whether tables are copied\n Default is True\n\n :param kwargs: Parameters that can be passed to the hidden copy functions called\n \"\"\"\n mapping = kwargs.get('mapping', dict())\n updateLinks = kwargs.get('updateLinks', True)\n updateSynIds = kwargs.get('updateSynIds', True)\n entitySubPageId = kwargs.get('entitySubPageId',None)\n destinationSubPageId = kwargs.get('destinationSubPageId',None)\n\n mapping = _copyRecursive(syn, entity, destinationId, mapping=mapping,**kwargs)\n if copyWikiPage:\n for oldEnt in mapping:\n newWikig = copyWiki(syn, oldEnt, mapping[oldEnt], entitySubPageId=entitySubPageId, destinationSubPageId=destinationSubPageId, updateLinks=updateLinks, updateSynIds=updateSynIds, entityMap=mapping)\n return(mapping)", "metadata": "root.copy", "header": "['module', '___EOS___']", "index": 10 }, { "content": "def _copyRecursive(syn, entity, destinationId, mapping = dict(), **kwargs):\n \"\"\"\n Recursively copies synapse entites, but does not copy the wikis\n\n :param entity: A synapse entity ID\n\n :param destinationId: Synapse ID of a folder/project that the copied entity is being copied to\n\n :param mapping: Takes a mapping {'oldSynId': 'newSynId'} to help with copying syn ids that aren't already part of the entity\n Default to dict() and builds the mapping of all the synapse entities copied\n \"\"\"\n\n version = kwargs.get('version', None)\n setProvenance = kwargs.get('setProvenance', \"traceback\")\n recursive = kwargs.get('recursive',True)\n copyTable = kwargs.get('copyTable',True)\n replace = kwargs.get('replace',False)\n\n ent = syn.get(entity,downloadFile=False)\n if isinstance(ent, Project):\n if destinationId is None:\n newProject = syn.store(Project(\"Copied %s %s\" %(time.time(),ent.name)))\n destinationId = newProject.id\n elif not isinstance(syn.get(destinationId),Project):\n raise ValueError(\"You must give a destinationId of a new project to copy projects\")\n copiedId = destinationId\n entities = syn.chunkedQuery('select id, name from entity where parentId==\"%s\"' % ent.id)\n for i in entities:\n mapping = _copyRecursive(syn, i['entity.id'], destinationId, mapping=mapping, **kwargs)\n else:\n if destinationId is None:\n raise ValueError(\"You must give a destinationId unless you are copying a project\")\n elif isinstance(ent, Folder):\n copiedId = _copyFolder(syn, ent.id, destinationId, mapping=mapping, **kwargs)\n elif isinstance(ent, File):\n copiedId = _copyFile(syn, ent.id, destinationId, version=version, replace=replace, setProvenance=setProvenance)\n elif isinstance(ent, Link):\n copiedId = _copyLink(syn, ent.id, destinationId)\n elif isinstance(ent, Schema) and copyTable:\n copiedId = _copyTable(syn, ent.id, destinationId)\n else:\n raise ValueError(\"Not able to copy this type of file\")\n\n print(\"Copied %s to %s\" % (ent.id,copiedId))\n mapping[ent.id] = copiedId\n return(mapping)", "metadata": "root._copyRecursive", "header": "['module', '___EOS___']", "index": 39 }, { "content": "def _copyFolder(syn, entity, destinationId, mapping=dict(), **kwargs):\n \"\"\"\n Copies synapse folders\n\n :param entity: A synapse ID of a Folder entity\n\n :param destinationId: Synapse ID of a project/folder that the folder wants to be copied to\n \n :param recursive: Decides whether to copy everything in the folder.\n Defaults to True\n \"\"\"\n oldFolder = syn.get(entity)\n recursive = kwargs.get('recursive',True)\n #CHECK: If Folder name already exists, raise value error\n search = syn.query('select name from entity where parentId == \"%s\"' % destinationId)\n for i in search['results']:\n if i['entity.name'] == oldFolder.name:\n raise ValueError('An item named \"%s\" already exists in this location. Folder could not be copied'%oldFolder.name)\n\n newFolder = Folder(name = oldFolder.name,parent= destinationId)\n newFolder.annotations = oldFolder.annotations\n newFolder = syn.store(newFolder)\n if recursive:\n entities = syn.chunkedQuery('select id, name from entity where parentId==\"%s\"'% entity)\n for ent in entities:\n copied = _copyRecursive(syn, ent['entity.id'],newFolder.id,mapping, **kwargs)\n return(newFolder.id)", "metadata": "root._copyFolder", "header": "['module', '___EOS___']", "index": 86 }, { "content": "def copyWiki(syn, entity, destinationId, entitySubPageId=None, destinationSubPageId=None, updateLinks=True, updateSynIds=True, entityMap=None):\n \"\"\"\n Copies wikis and updates internal links\n\n :param entity: A synapse ID of an entity whose wiki you want to copy\n\n :param destinationId: Synapse ID of a folder/project that the wiki wants to be copied to\n \n :param updateLinks: Update all the internal links\n Defaults to True\n\n :param updateSynIds: Update all the synapse ID's referenced in the wikis\n Defaults to True but needs an entityMap\n\n :param entityMap: An entity map {'oldSynId','newSynId'} to update the synapse IDs referenced in the wiki\n Defaults to None \n\n :param entitySubPageId: Can specify subPageId and copy all of its subwikis\n Defaults to None, which copies the entire wiki\n subPageId can be found: https://www.synapse.org/#!Synapse:syn123/wiki/1234\n In this case, 1234 is the subPageId. \n\n :param destinationSubPageId: Can specify destination subPageId to copy wikis to\n Defaults to None\n \"\"\"\n oldOwn = syn.get(entity,downloadFile=False)\n # getWikiHeaders fails when there is no wiki\n try:\n oldWh = syn.getWikiHeaders(oldOwn)\n store = True\n except SynapseHTTPError:\n store = False\n if store:\n if entitySubPageId is not None:\n oldWh = _getSubWikiHeaders(oldWh,entitySubPageId,mapping=[])\n newOwn =syn.get(destinationId,downloadFile=False)\n wikiIdMap =dict()\n newWikis=dict()\n for i in oldWh:\n attDir=tempfile.NamedTemporaryFile(prefix='attdir',suffix='')\n #print i['id']\n wiki = syn.getWiki(oldOwn, i.id)\n print('Got wiki %s' % i.id)\n if wiki['attachmentFileHandleIds'] == []:\n attachments = []\n elif wiki['attachmentFileHandleIds'] != []:\n uri = \"/entity/%s/wiki/%s/attachmenthandles\" % (wiki.ownerId, wiki.id)\n results = syn.restGET(uri)\n file_handles = {fh['id']:fh for fh in results['list']}\n ## need to download an re-upload wiki attachments, ug!\n attachments = []\n tempdir = tempfile.gettempdir()\n for fhid in wiki.attachmentFileHandleIds:\n file_info = syn._downloadWikiAttachment(wiki.ownerId, wiki, file_handles[fhid]['fileName'], destination=tempdir)\n attachments.append(file_info['path'])\n #for some reason some wikis don't have titles?\n if hasattr(i, 'parentId'):\n wNew = Wiki(owner=newOwn, title=wiki.get('title',''), markdown=wiki.markdown, attachments=attachments, parentWikiId=wikiIdMap[wiki.parentWikiId])\n wNew = syn.store(wNew)\n else:\n wNew = Wiki(owner=newOwn, title=wiki.get('title',''), markdown=wiki.markdown, attachments=attachments, parentWikiId=destinationSubPageId)\n wNew = syn.store(wNew)\n parentWikiId = wNew.id\n newWikis[wNew.id]=wNew\n wikiIdMap[wiki.id] =wNew.id\n\n if updateLinks:\n print(\"Updating internal links:\\n\")\n for oldWikiId in wikiIdMap.keys():\n # go through each wiki page once more:\n newWikiId=wikiIdMap[oldWikiId]\n newWiki=newWikis[newWikiId]\n print(\"\\tUpdating internal links for Page: %s\\n\" % newWikiId)\n s=newWiki.markdown\n # in the markdown field, replace all occurrences of entity/wiki/abc with destinationId/wiki/xyz,\n # where wikiIdMap maps abc->xyz\n # replace <entity>/wiki/<oldWikiId> with <destinationId>/wiki/<newWikiId> \n for oldWikiId2 in wikiIdMap.keys():\n oldProjectAndWikiId = \"%s/wiki/%s\" % (entity, oldWikiId2)\n newProjectAndWikiId = \"%s/wiki/%s\" % (destinationId, wikiIdMap[oldWikiId2])\n s=re.sub(oldProjectAndWikiId, newProjectAndWikiId, s)\n # now replace any last references to entity with destinationId\n s=re.sub(entity, destinationId, s)\n newWikis[newWikiId].markdown=s\n\n if updateSynIds and entityMap is not None:\n print(\"Updating Synapse references:\\n\")\n for oldWikiId in wikiIdMap.keys():\n # go through each wiki page once more:\n newWikiId = wikiIdMap[oldWikiId]\n newWiki = newWikis[newWikiId]\n print('Updated Synapse references for Page: %s\\n' %newWikiId)\n s = newWiki.markdown\n\n for oldSynId in entityMap.keys():\n # go through each wiki page once more:\n newSynId = entityMap[oldSynId]\n s = re.sub(oldSynId, newSynId, s)\n print(\"Done updating Synpase IDs.\\n\")\n newWikis[newWikiId].markdown = s\n \n print(\"Storing new Wikis\\n\")\n for oldWikiId in wikiIdMap.keys():\n newWikiId = wikiIdMap[oldWikiId]\n newWikis[newWikiId] = syn.store(newWikis[newWikiId])\n print(\"\\tStored: %s\\n\",newWikiId)\n newWh = syn.getWikiHeaders(newOwn)\n return(newWh)\n else:\n return(\"no wiki\")", "metadata": "root.copyWiki", "header": "['module', '___EOS___']", "index": 282 } ]
[ { "span": "newWikig ", "start_line": 35, "start_column": 12, "end_line": 35, "end_column": 20 }, { "span": "recursive ", "start_line": 53, "start_column": 4, "end_line": 53, "end_column": 13 }, { "span": "copied ", "start_line": 111, "start_column": 12, "end_line": 111, "end_column": 18 }, { "span": "attDir=", "start_line": 321, "start_column": 12, "end_line": 321, "end_column": 18 }, { "span": "parentWikiId ", "start_line": 344, "start_column": 16, "end_line": 344, "end_column": 28 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "copy_", "(_", "syn_", ",_", "entity_", ",_", "destinat", "ion", "Id_", "=_", "None_", ",_", "copy", "Wiki", "Page_", "=_", "True_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Copie", "s", " ", "synapse", " ", "entit", "ies", " ", "inclu", "ding", " ", "the", " ", "wiki", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "entity", ":", " ", " ", "A", " ", "synapse", " ", "entity", " ", "ID", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "destinat", "ion", "Id", ":", " ", " ", " ", "Synapse", " ", "ID", " ", "of", " ", "a", " ", "folder", "/", "project", " ", "tha", "t", " ", "the", " ", "copie", "d", " ", "entity", " ", "is", " ", "bei", "ng", " ", "copie", "d", " ", "to", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "copy", "Wiki", "Page", ":", " ", " ", " ", " ", "Det", "erm", "ine", "s", " ", "whe", "ther", " ", "the", " ", "wiki", " ", "of", " ", "the", " ", "entity", " ", "is", " ", "copie", "d", " ", "over", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Default", " ", "is", " ", "Tru", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "copy", "Table", ":", " ", " ", " ", "Det", "erm", "ine", "s", " ", "whe", "ther", " ", "tables", " ", "are", " ", "copie", "d", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Default", " ", "is", " ", "Tru", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "kwarg", "s", ":", " ", " ", "Parameter", "s", " ", "tha", "t", " ", "can", " ", "be", " ", "pass", "ed", " ", "to", " ", "the", " ", "hidden", " ", "copy", " ", "function", "s", " ", "call", "ed", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapping_", "=_", "kwargs_", "._", "get_", "(_", "'", "mapping", "'_", ",_", "dict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Links_", "=_", "kwargs_", "._", "get_", "(_", "'", "update", "Link", "s", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Syn", "Ids_", "=_", "kwargs_", "._", "get_", "(_", "'", "update", "Syn", "Id", "s", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity", "Sub", "Page", "Id_", "=_", "kwargs_", "._", "get_", "(_", "'", "entity", "Sub", "Page", "Id", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destinat", "ion", "Sub", "Page", "Id_", "=_", "kwargs_", "._", "get_", "(_", "'", "destinat", "ion", "Sub", "Page", "Id", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mapping_", "=_", "\\u", "copy", "Recursive", "_", "(_", "syn_", ",_", "entity_", ",_", "destinat", "ion", "Id_", ",_", "mapping_", "=_", "mapping_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "copy", "Wiki", "Page_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "old", "Ent", "_", "in_", "mapping_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Wiki", "g_", "=_", "copy", "Wiki", "_", "(_", "syn_", ",_", "old", "Ent", "_", ",_", "mapping_", "[_", "old", "Ent", "_", "]_", ",_", "entity", "Sub", "Page", "Id_", "=_", "entity", "Sub", "Page", "Id_", ",_", "destinat", "ion", "Sub", "Page", "Id_", "=_", "destinat", "ion", "Sub", "Page", "Id_", ",_", "update", "Links_", "=_", "update", "Links_", ",_", "update", "Syn", "Ids_", "=_", "update", "Syn", "Ids_", ",_", "entity", "Map_", "=_", "mapping_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "mapping_", ")_", "\\u\\u\\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", "copy", "Recursive", "_", "(_", "syn_", ",_", "entity_", ",_", "destinat", "ion", "Id_", ",_", "mapping_", "=_", "dict_", "(_", ")_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Recursive", "ly", " ", "copie", "s", " ", "synapse", " ", "entit", "es", ",", " ", "but", " ", "doe", "s", " ", "not", " ", "copy", " ", "the", " ", "wiki", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "entity", ":", " ", " ", " ", " ", " ", "A", " ", "synapse", " ", "entity", " ", "ID", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "destinat", "ion", "Id", ":", " ", " ", "Synapse", " ", "ID", " ", "of", " ", "a", " ", "folder", "/", "project", " ", "tha", "t", " ", "the", " ", "copie", "d", " ", "entity", " ", "is", " ", "bei", "ng", " ", "copie", "d", " ", "to", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "mapping", ":", " ", " ", " ", " ", "Tak", "es", " ", "a", " ", "mapping", " ", "{", "'", "old", "Syn", "Id", "':", " ", "'", "new", "Syn", "Id", "'}", " ", "to", " ", "help", " ", "with", " ", "copy", "ing", " ", "syn", " ", "ids", " ", "tha", "t", " ", "are", "n", "'", "t", " ", "alr", "ead", "y", " ", "part", " ", "of", " ", "the", " ", "entity", "\\", "10", ";", " ", " ", " ", " ", " ", "Default", " ", "to", " ", "dict", "()", " ", "and", " ", "builds", " ", "the", " ", "mapping", " ", "of", " ", "all", " ", "the", " ", "synapse", " ", "entit", "ies", " ", "copie", "d", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "kwargs_", "._", "get_", "(_", "'", "version", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set", "Prov", "ena", "nce_", "=_", "kwargs_", "._", "get_", "(_", "'", "set", "Prov", "ena", "nce", "'_", ",_", "\"", "traceback", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recursive_", "=_", "kwargs_", "._", "get_", "(_", "'", "recurs", "ive", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "Table_", "=_", "kwargs_", "._", "get_", "(_", "'", "copy", "Table", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replace_", "=_", "kwargs_", "._", "get_", "(_", "'", "replace", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ent_", "=_", "syn_", "._", "get_", "(_", "entity_", ",_", "download", "File_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "ent_", ",_", "Project_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "destinat", "ion", "Id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Project_", "=_", "syn_", "._", "store_", "(_", "Project_", "(_", "\"", "Copie", "d", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "time_", "._", "time_", "(_", ")_", ",_", "ent_", "._", "name_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destinat", "ion", "Id_", "=_", "new", "Project_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "isinstance_", "(_", "syn_", "._", "get_", "(_", "destinat", "ion", "Id_", ")_", ",_", "Project_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "You", " ", "must", " ", "give", " ", "a", " ", "destinat", "ion", "Id", " ", "of", " ", "a", " ", "new", " ", "project", " ", "to", " ", "copy", " ", "project", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "copie", "d", "Id_", "=_", "destinat", "ion", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entities_", "=_", "syn_", "._", "chunked", "Query_", "(_", "'", "select", " ", "id", ",", " ", "name", " ", "from", " ", "entity", " ", "where", " ", "parent", "Id", "==", "\"%", "s", "\"'_", "%_", "ent_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "entities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mapping_", "=_", "\\u", "copy", "Recursive", "_", "(_", "syn_", ",_", "i_", "[_", "'", "entity", ".", "id", "'_", "]_", ",_", "destinat", "ion", "Id_", ",_", "mapping_", "=_", "mapping_", ",_", "**_", "kwargs_", ")_", "\\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_", "destinat", "ion", "Id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "You", " ", "must", " ", "give", " ", "a", " ", "destinat", "ion", "Id", " ", "unl", "ess", " ", "you", " ", "are", " ", "copy", "ing", " ", "a", " ", "project", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "ent_", ",_", "Folder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copie", "d", "Id_", "=_", "\\u", "copy", "Folder_", "(_", "syn_", ",_", "ent_", "._", "id_", ",_", "destinat", "ion", "Id_", ",_", "mapping_", "=_", "mapping_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "ent_", ",_", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copie", "d", "Id_", "=_", "\\u", "copy", "File_", "(_", "syn_", ",_", "ent_", "._", "id_", ",_", "destinat", "ion", "Id_", ",_", "version_", "=_", "version_", ",_", "replace_", "=_", "replace_", ",_", "set", "Prov", "ena", "nce_", "=_", "set", "Prov", "ena", "nce_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "ent_", ",_", "Link_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copie", "d", "Id_", "=_", "\\u", "copy", "Link_", "(_", "syn_", ",_", "ent_", "._", "id_", ",_", "destinat", "ion", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "ent_", ",_", "Schema_", ")_", "and_", "copy", "Table_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copie", "d", "Id_", "=_", "\\u", "copy", "Table_", "(_", "syn_", ",_", "ent_", "._", "id_", ",_", "destinat", "ion", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Not", " ", "able", " ", "to", " ", "copy", " ", "this", " ", "type", " ", "of", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Copie", "d", " ", "%", "s", " ", "to", " ", "%", "s", "\"_", "%_", "(_", "ent_", "._", "id_", ",_", "copie", "d", "Id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapping_", "[_", "ent_", "._", "id_", "]_", "=_", "copie", "d", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "mapping_", ")_", "\\u\\u\\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", "copy", "Folder_", "(_", "syn_", ",_", "entity_", ",_", "destinat", "ion", "Id_", ",_", "mapping_", "=_", "dict_", "(_", ")_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Copie", "s", " ", "synapse", " ", "folder", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "entity", ":", " ", " ", "A", " ", "synapse", " ", "ID", " ", "of", " ", "a", " ", "Fold", "er", " ", "entity", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "destinat", "ion", "Id", ":", " ", " ", " ", "Synapse", " ", "ID", " ", "of", " ", "a", " ", "project", "/", "folder", " ", "tha", "t", " ", "the", " ", "folder", " ", "want", "s", " ", "to", " ", "be", " ", "copie", "d", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "recurs", "ive", ":", " ", " ", " ", "Deci", "des", " ", "whe", "ther", " ", "to", " ", "copy", " ", "every", "thing", " ", "in", " ", "the", " ", "folder", ".", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Default", "s", " ", "to", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "Folder_", "=_", "syn_", "._", "get_", "(_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recursive_", "=_", "kwargs_", "._", "get_", "(_", "'", "recurs", "ive", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "CHECK", ":", " ", "If", " ", "Fold", "er", " ", "name", " ", "alr", "ead", "y", " ", "exist", "s", ",", " ", "raise", " ", "value", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "search_", "=_", "syn_", "._", "query_", "(_", "'", "select", " ", "name", " ", "from", " ", "entity", " ", "where", " ", "parent", "Id", " ", "==", " ", "\"%", "s", "\"'_", "%_", "destinat", "ion", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "search_", "[_", "'", "results", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "[_", "'", "entity", ".", "name", "'_", "]_", "==_", "old", "Folder_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "An", " ", "item", " ", "named", " ", "\"%", "s", "\"", " ", "alr", "ead", "y", " ", "exist", "s", " ", "in", " ", "this", " ", "location", ".", " ", "Fold", "er", " ", "coul", "d", " ", "not", " ", "be", " ", "copie", "d", "'_", "%_", "old", "Folder_", "._", "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_", "new", "Folder_", "=_", "Folder_", "(_", "name_", "=_", "old", "Folder_", "._", "name_", ",_", "parent_", "=_", "destinat", "ion", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Folder_", "._", "annotations_", "=_", "old", "Folder_", "._", "annotations_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Folder_", "=_", "syn_", "._", "store_", "(_", "new", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "recursive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entities_", "=_", "syn_", "._", "chunked", "Query_", "(_", "'", "select", " ", "id", ",", " ", "name", " ", "from", " ", "entity", " ", "where", " ", "parent", "Id", "==", "\"%", "s", "\"'_", "%_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ent_", "in_", "entities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copied_", "=_", "\\u", "copy", "Recursive", "_", "(_", "syn_", ",_", "ent_", "[_", "'", "entity", ".", "id", "'_", "]_", ",_", "new", "Folder_", "._", "id_", ",_", "mapping_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "new", "Folder_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copy", "Wiki", "_", "(_", "syn_", ",_", "entity_", ",_", "destinat", "ion", "Id_", ",_", "entity", "Sub", "Page", "Id_", "=_", "None_", ",_", "destinat", "ion", "Sub", "Page", "Id_", "=_", "None_", ",_", "update", "Links_", "=_", "True_", ",_", "update", "Syn", "Ids_", "=_", "True_", ",_", "entity", "Map_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Copie", "s", " ", "wiki", "s", " ", "and", " ", "update", "s", " ", "internal", " ", "link", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "entity", ":", " ", " ", " ", " ", " ", " ", "A", " ", "synapse", " ", "ID", " ", "of", " ", "an", " ", "entity", " ", "who", "se", " ", "wiki", " ", "you", " ", "want", " ", "to", " ", "copy", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "destinat", "ion", "Id", ":", " ", " ", " ", "Synapse", " ", "ID", " ", "of", " ", "a", " ", "folder", "/", "project", " ", "tha", "t", " ", "the", " ", "wiki", " ", "want", "s", " ", "to", " ", "be", " ", "copie", "d", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "update", "Link", "s", ":", " ", " ", " ", " ", " ", "Update", " ", "all", " ", "the", " ", "internal", " ", "link", "s", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Default", "s", " ", "to", " ", "Tru", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "update", "Syn", "Id", "s", ":", " ", " ", " ", " ", "Update", " ", "all", " ", "the", " ", "synapse", " ", "ID", "'", "s", " ", "referenced", " ", "in", " ", "the", " ", "wiki", "s", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Default", "s", " ", "to", " ", "Tru", "e", " ", "but", " ", "need", "s", " ", "an", " ", "entity", "Map", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "entity", "Map", ":", " ", " ", " ", "An", " ", "entity", " ", "map", " ", "{", "'", "old", "Syn", "Id", "','", "new", "Syn", "Id", "'}", " ", "to", " ", "update", " ", "the", " ", "synapse", " ", "ID", "s", " ", "referenced", " ", "in", " ", "the", " ", "wiki", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Default", "s", " ", "to", " ", "Non", "e", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "entity", "Sub", "Page", "Id", ":", " ", " ", " ", " ", " ", "Can", " ", "speci", "fy", " ", "sub", "Page", "Id", " ", "and", " ", "copy", " ", "all", " ", "of", " ", "its", " ", "subw", "iki", "s", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Default", "s", " ", "to", " ", "Non", "e", ",", " ", "whi", "ch", " ", "copie", "s", " ", "the", " ", "entire", " ", "wiki", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "sub", "Page", "Id", " ", "can", " ", "be", " ", "found", ":", " ", "https", "://", "www", ".", "synapse", ".", "org", "/", "#!", "Synapse", ":", "syn", "123", "/", "wiki", "/", "1234", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "In", " ", "this", " ", "case", ",", " ", "1234", " ", "is", " ", "the", " ", "sub", "Page", "Id", ".", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "destinat", "ion", "Sub", "Page", "Id", ":", " ", " ", " ", " ", "Can", " ", "speci", "fy", " ", "destinat", "ion", " ", "sub", "Page", "Id", " ", "to", " ", "copy", " ", "wiki", "s", " ", "to", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Default", "s", " ", "to", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "Own", "_", "=_", "syn_", "._", "get_", "(_", "entity_", ",_", "download", "File_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", "Wiki", "Head", "ers", " ", "fail", "s", " ", "whe", "n", " ", "there", " ", "is", " ", "no", " ", "wiki_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "Wh", "_", "=_", "syn_", "._", "get", "Wiki", "Headers_", "(_", "old", "Own", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "store_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Synapse", "HTTP", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "store_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "store_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "entity", "Sub", "Page", "Id_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "Wh", "_", "=_", "\\u", "get", "Sub", "Wiki", "Headers_", "(_", "old", "Wh", "_", ",_", "entity", "Sub", "Page", "Id_", ",_", "mapping_", "=_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "Own", "_", "=_", "syn_", "._", "get_", "(_", "destinat", "ion", "Id_", ",_", "download", "File_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wiki", "Id", "Map_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Wiki", "s_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "old", "Wh", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "att", "Dir_", "=_", "tempfile_", "._", "Name", "d", "Tempora", "ry", "File_", "(_", "prefix_", "=_", "'", "att", "dir", "'_", ",_", "suffix_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "i", "['", "id", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "wiki_", "=_", "syn_", "._", "get", "Wiki", "_", "(_", "old", "Own", "_", ",_", "i_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Got", " ", "wiki", " ", "%", "s", "'_", "%_", "i_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wiki_", "[_", "'", "attach", "ment", "File", "Handle", "Id", "s", "'_", "]_", "==_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attachments_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "wiki_", "[_", "'", "attach", "ment", "File", "Handle", "Id", "s", "'_", "]_", "!=_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri_", "=_", "\"/", "entity", "/", "%", "s", "/", "wiki", "/", "%", "s", "/", "attach", "ment", "handle", "s", "\"_", "%_", "(_", "wiki_", "._", "owner", "Id_", ",_", "wiki_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "syn_", "._", "rest", "GET_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "handles_", "=_", "{_", "fh_", "[_", "'", "id", "'_", "]_", ":_", "fh_", "for_", "fh_", "in_", "results_", "[_", "'", "list", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "need", " ", "to", " ", "download", " ", "an", " ", "re", "-", "upload", " ", "wiki", " ", "attach", "ment", "s", ",", " ", "ug", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "attachments_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tempdir_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fh", "id_", "in_", "wiki_", "._", "attach", "ment", "File", "Handle", "Ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "file", "\\u", "info_", "=_", "syn_", "._", "\\u", "download", "Wiki", "Attachment_", "(_", "wiki_", "._", "owner", "Id_", ",_", "wiki_", ",_", "file", "\\u", "handles_", "[_", "fh", "id_", "]_", "[_", "'", "file", "Name", "'_", "]_", ",_", "destination_", "=_", "tempdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attachments_", "._", "append_", "(_", "file", "\\u", "info_", "[_", "'", "path", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "for", " ", "some", " ", "reason", " ", "some", " ", "wiki", "s", " ", "don", "'", "t", " ", "have", " ", "titles", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "i_", ",_", "'", "parent", "Id", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w", "New_", "=_", "Wiki", "_", "(_", "owner_", "=_", "new", "Own", "_", ",_", "title_", "=_", "wiki_", "._", "get_", "(_", "'", "title", "'_", ",_", "''_", ")_", ",_", "markdown_", "=_", "wiki_", "._", "markdown_", ",_", "attachments_", "=_", "attachments_", ",_", "parent", "Wiki", "Id_", "=_", "wiki", "Id", "Map_", "[_", "wiki_", "._", "parent", "Wiki", "Id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w", "New_", "=_", "syn_", "._", "store_", "(_", "w", "New_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w", "New_", "=_", "Wiki", "_", "(_", "owner_", "=_", "new", "Own", "_", ",_", "title_", "=_", "wiki_", "._", "get_", "(_", "'", "title", "'_", ",_", "''_", ")_", ",_", "markdown_", "=_", "wiki_", "._", "markdown_", ",_", "attachments_", "=_", "attachments_", ",_", "parent", "Wiki", "Id_", "=_", "destinat", "ion", "Sub", "Page", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w", "New_", "=_", "syn_", "._", "store_", "(_", "w", "New_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "Wiki", "Id_", "=_", "w", "New_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "Wiki", "s_", "[_", "w", "New_", "._", "id_", "]_", "=_", "w", "New_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wiki", "Id", "Map_", "[_", "wiki_", "._", "id_", "]_", "=_", "w", "New_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "update", "Links_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Up", "dati", "ng", " ", "internal", " ", "link", "s", ":\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "old", "Wiki", "Id_", "in_", "wiki", "Id", "Map_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "go", " ", "through", " ", "each", " ", "wiki", " ", "page", " ", "onc", "e", " ", "more", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Wiki", "Id_", "=_", "wiki", "Id", "Map_", "[_", "old", "Wiki", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Wiki", "_", "=_", "new", "Wiki", "s_", "[_", "new", "Wiki", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"\\\\", "t", "Up", "dati", "ng", " ", "internal", " ", "link", "s", " ", "for", " ", "Page", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "new", "Wiki", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "new", "Wiki", "_", "._", "markdown_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "mark", "down", " ", "field", ",", " ", "replace", " ", "all", " ", "occurrences", " ", "of", " ", "entity", "/", "wiki", "/", "abc", " ", "with", " ", "destinat", "ion", "Id", "/", "wiki", "/", "xyz", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "where", " ", "wiki", "Id", "Map", " ", "maps", " ", "abc", "->", "xyz_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "replace", " ", "<", "entity", ">/", "wiki", "/", "<", "old", "Wiki", "Id", ">", " ", "with", " ", "<", "destinat", "ion", "Id", ">/", "wiki", "/", "<", "new", "Wiki", "Id", ">", " _", "\\u\\u\\uNL\\u\\u\\u_", "for_", "old", "Wiki", "Id", "2_", "in_", "wiki", "Id", "Map_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "old", "Project", "And", "Wiki", "Id_", "=_", "\"%", "s", "/", "wiki", "/", "%", "s", "\"_", "%_", "(_", "entity_", ",_", "old", "Wiki", "Id", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Project", "And", "Wiki", "Id_", "=_", "\"%", "s", "/", "wiki", "/", "%", "s", "\"_", "%_", "(_", "destinat", "ion", "Id_", ",_", "wiki", "Id", "Map_", "[_", "old", "Wiki", "Id", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "re_", "._", "sub_", "(_", "old", "Project", "And", "Wiki", "Id_", ",_", "new", "Project", "And", "Wiki", "Id_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "now", " ", "replace", " ", "any", " ", "last", " ", "reference", "s", " ", "to", " ", "entity", " ", "with", " ", "destinat", "ion", "Id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "re_", "._", "sub_", "(_", "entity_", ",_", "destinat", "ion", "Id_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Wiki", "s_", "[_", "new", "Wiki", "Id_", "]_", "._", "markdown_", "=_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "update", "Syn", "Ids_", "and_", "entity", "Map_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Up", "dati", "ng", " ", "Synapse", " ", "reference", "s", ":\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "old", "Wiki", "Id_", "in_", "wiki", "Id", "Map_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "go", " ", "through", " ", "each", " ", "wiki", " ", "page", " ", "onc", "e", " ", "more", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Wiki", "Id_", "=_", "wiki", "Id", "Map_", "[_", "old", "Wiki", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Wiki", "_", "=_", "new", "Wiki", "s_", "[_", "new", "Wiki", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Update", "d", " ", "Synapse", " ", "reference", "s", " ", "for", " ", "Page", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "new", "Wiki", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "new", "Wiki", "_", "._", "markdown_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "old", "Syn", "Id_", "in_", "entity", "Map_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "go", " ", "through", " ", "each", " ", "wiki", " ", "page", " ", "onc", "e", " ", "more", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "Syn", "Id_", "=_", "entity", "Map_", "[_", "old", "Syn", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "re_", "._", "sub_", "(_", "old", "Syn", "Id_", ",_", "new", "Syn", "Id_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Don", "e", " ", "updat", "ing", " ", "Syn", "pas", "e", " ", "ID", "s", ".\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Wiki", "s_", "[_", "new", "Wiki", "Id_", "]_", "._", "markdown_", "=_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Stor", "ing", " ", "new", " ", "Wiki", "s", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "old", "Wiki", "Id_", "in_", "wiki", "Id", "Map_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Wiki", "Id_", "=_", "wiki", "Id", "Map_", "[_", "old", "Wiki", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Wiki", "s_", "[_", "new", "Wiki", "Id_", "]_", "=_", "syn_", "._", "store_", "(_", "new", "Wiki", "s_", "[_", "new", "Wiki", "Id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"\\\\", "t", "Stor", "ed", ":", " ", "%", "s", "\\\\", "n", "\"_", ",_", "new", "Wiki", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "Wh", "_", "=_", "syn_", "._", "get", "Wiki", "Headers_", "(_", "new", "Own", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "new", "Wh", "_", ")_", "\\u\\u\\uNEWLINE\\u\\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 ]
Unused local variable
dotskapes/dotSkapes/controllers/geoserver.py
[ { "content": "def filter():\n lookup_id = require_alphanumeric (request.vars.get ('ID'))\n filter_field = require_alphanumeric (request.vars.get ('FIELD'))\n filter_mode = require_alphanumeric (request.vars.get ('MODE'))\n filter_value = require_decimal (request.vars.get ('VALUE'))\n data = dm.get ('maps', lookup_id)\n content_type = request.vars.get ('Content-Type') or 'text'\n post_vars = {}\n post_vars.update (request.vars);\n style = open ('applications/' + request.application + '/templates/geoserver/filter.xsd').read () % {\n 'layer_name': data.prefix + ':' + data.filename,\n 'field_name': filter_field,\n 'filter_value': filter_value,\n }\n post_vars.update ({'sld_body': style})\n \n map_data = urlopen (data.src + '/wfs', urlencode (post_vars))\n return map_data.read () ", "metadata": "root.filter", "header": "['module', '___EOS___']", "index": 68 } ]
[ { "span": "filter_mode ", "start_line": 71, "start_column": 4, "end_line": 71, "end_column": 15 }, { "span": "content_type ", "start_line": 74, "start_column": 4, "end_line": 74, "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_", "filter_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "look", "up", "\\u", "id_", "=_", "require", "\\u", "alphanumeric", "_", "(_", "request_", "._", "vars_", "._", "get_", "(_", "'", "ID", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "field_", "=_", "require", "\\u", "alphanumeric", "_", "(_", "request_", "._", "vars_", "._", "get_", "(_", "'", "FIE", "LD", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "mode_", "=_", "require", "\\u", "alphanumeric", "_", "(_", "request_", "._", "vars_", "._", "get_", "(_", "'", "MODE", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "value_", "=_", "require", "\\u", "decimal_", "(_", "request_", "._", "vars_", "._", "get_", "(_", "'", "VALU", "E", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "dm_", "._", "get_", "(_", "'", "maps", "'_", ",_", "look", "up", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", "=_", "request_", "._", "vars_", "._", "get_", "(_", "'", "Conten", "t", "-", "Type", "'_", ")_", "or_", "'", "text", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "vars_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "vars_", "._", "update_", "(_", "request_", "._", "vars_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "style_", "=_", "open_", "(_", "'", "applica", "tion", "s", "/'_", "+_", "request_", "._", "application_", "+_", "'/", "template", "s", "/", "geoserver", "/", "filter", ".", "xsd", "'_", ")_", "._", "read_", "(_", ")_", "%_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "layer", "\\u", "name", "'_", ":_", "data_", "._", "prefix_", "+_", "':'_", "+_", "data_", "._", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "field", "\\u", "name", "'_", ":_", "filter", "\\u", "field_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filter", "\\u", "value", "'_", ":_", "filter", "\\u", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "vars_", "._", "update_", "(_", "{_", "'", "sld", "\\u", "body", "'_", ":_", "style_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "map", "\\u", "data_", "=_", "urlopen_", "(_", "data_", "._", "src_", "+_", "'/", "wfs", "'_", ",_", "urlencode_", "(_", "post", "\\u", "vars_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "map", "\\u", "data_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
lisa-lab/pylearn2/pylearn2/train_extensions/tests/test_live_monitor.py
[ { "content": "\"\"\"\nModule for testing LiveMonitoring.\n\"\"\"\nimport unittest\nfrom nose.tools import assert_raises\nimport os\nimport multiprocessing as mp\n\ntry:\n import zmq\nexcept:\n zmq = None\n\nimport pylearn2\nfrom pylearn2.scripts.train import train\nimport pylearn2.train_extensions.live_monitoring as lm\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Modul", "e", " ", "for", " ", "testi", "ng", " ", "Live", "Monitor", "ing", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "raises_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "as_", "mp_", "\\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_", "zmq_", "\\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 ", " _", "zmq_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "pyl", "earn", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "scripts_", "._", "train_", "import_", "train_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyl", "earn", "2_", "._", "train", "\\u", "extensions_", "._", "live", "\\u", "monitorin", "g_", "as_", "lm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
cornell-brg/pymtl/pclib/test/TestSimpleMemory.py
[ { "content": " def __init__( s, memreq_params, memresp_params, nports,\n mem_nbytes=2**20 ):\n\n # Local constant - store the number of ports\n\n req_nbits = memreq_params.nbits\n resp_nbits = memresp_params.nbits\n\n # List of memory request ports\n\n s.reqs = [ InValRdyBundle( req_nbits ) for _ in range( nports ) ]\n\n # List of memory response ports\n\n s.resps = [ OutValRdyBundle( resp_nbits ) for _ in range( nports ) ]\n\n # Memory message parameters\n\n s.memreq_params = memreq_params\n s.memresp_params = memresp_params\n\n # Checks\n\n assert s.memreq_params.data_nbits % 8 == 0\n assert s.memresp_params.data_nbits % 8 == 0\n\n # List of Unpack models\n\n s.memreq = [ mem_msgs.MemReqFromBits( memreq_params ) for _ in\n range( nports ) ]\n\n # List of Pack models\n\n s.memresp = [ mem_msgs.MemRespToBits( memresp_params ) for _ in\n range( nports ) ]\n\n s.mem_nbytes = mem_nbytes\n\n #---------------------------------------------------------------------\n # Connectivity and Logic\n #---------------------------------------------------------------------\n\n # Buffers to hold memory request messages\n\n s.memreq_type = [ Bits( 1) for _ in range( nports ) ]\n s.memreq_addr = [ Bits(32) for _ in range( nports ) ]\n s.memreq_len = [ Bits( 2) for _ in range( nports ) ]\n s.memreq_data = [ Bits(32) for _ in range( nports ) ]\n\n s.memreq_full = [ Wire(1) for _ in range( nports ) ]\n\n # Actual memory\n s.mem = bytearray( s.mem_nbytes )\n\n # Connect memreq_msg port list to Unpack port list\n for i in range( nports ):\n s.connect( s.reqs[i].msg, s.memreq[i].bits )\n\n\n # Connect memresp_msg port list to Pack port list\n for i in range( nports ):\n s.connect( s.resps[i].msg, s.memresp[i].bits )\n\n #-----------------------------------------------------------------------\n # Tick\n #-----------------------------------------------------------------------\n\n @s.posedge_clk\n def tick():\n\n # Iterate over the port list\n\n for i in range( nports ):\n\n # At the end of the cycle, we AND together the val/rdy bits to\n # determine if the request/memresp message transactions occured.\n\n s.memreq_go = s.reqs[i].val and s.reqs[i].rdy\n s.memresp_go = s.resps[i].val and s.resps[i].rdy\n\n # If the memresp transaction occured, then clear the buffer full bit.\n # Note that we do this _first_ before we process the request\n # transaction so we can essentially pipeline this control logic.\n\n if s.memresp_go:\n s.memreq_full[i].next = 0\n\n # If the request transaction occured, then write the request message\n # into our internal buffer and update the buffer full bit\n\n if s.memreq_go:\n\n s.memreq_full[i].next = 1\n\n s.memreq_type[i] = s.memreq[i].type_\n s.memreq_addr[i] = s.memreq[i].addr\n s.memreq_len[i] = s.memreq[i].len_\n s.memreq_data[i] = s.memreq[i].data[:]\n\n # When len is zero, then we use all of the data\n\n nbytes = s.memreq_len[i]\n if s.memreq_len[i] == 0:\n nbytes = s.memreq_params.data_nbits/8\n\n # Handle a read request\n\n if s.memreq_type[i] == s.memreq_params.type_read:\n\n # Copy the bytes from the bytearray into read data bits\n\n read_data = Bits( s.memreq_params.data_nbits )\n for j in range( nbytes ):\n read_data[j*8:j*8+8] = s.mem[ s.memreq_addr[i] + j ]\n\n # Create the response message\n\n s.memresp[i].type_.next = s.memresp_params.type_read\n s.memresp[i].len_ .next = s.memreq_len[i]\n s.memresp[i].data .next = read_data\n\n # Handle a write request\n\n elif s.memreq_type[i] == s.memreq_params.type_write:\n\n # Copy write data bits into bytearray\n\n write_data = s.memreq_data[i]\n for j in range( nbytes ):\n s.mem[ s.memreq_addr[i] + j ] = write_data[j*8:j*8+8].uint()\n\n # Create the response message\n\n s.memresp[i].type_.next = s.memresp_params.type_write\n s.memresp[i].len_ .next = 0\n s.memresp[i].data .next = 0\n\n # For some reason this is causing an assert in PyMTL?\n #\n # else:\n # assert True, \"Unrecognized request message type! {}\" \\\n # .format( s.memreq_type[i] )\n\n\n #-----------------------------------------------------------------------\n # Combinational Logic\n #-----------------------------------------------------------------------\n # We model the TestSimpleMemory to behave like a normal queue. Instead of\n # combinationally hooking up the memresp_rdy to memreq_rdy, we see if\n # there is anything present in the buffer or not, to calculate request\n # ready signal.\n\n @s.combinational\n def comb():\n\n # Iterate over the port list\n\n for i in range( nports ):\n\n s.reqs[i].rdy.value = ( not s.memreq_full[i] or s.resps[i].rdy )\n s.resps[i].val.value = s.memreq_full[i]", "metadata": "root.TestSimpleMemory.__init__", "header": "['class', 'TestSimpleMemory', '(', 'Model', ')', ':', '___NEWLINE___', '___NL___', '#-----------------------------------------------------------------------', '___NL___', '# Constructor', '___NL___', '#-----------------------------------------------------------------------', '___NL___', '___EOS___']", "index": 20 }, { "content": " def line_trace( s ):\n\n memtrace_str = ''\n\n for req, resp in zip( s.reqs, s.resps ):\n memtrace_str += \"|{} () {}\".format( req, resp )\n\n return memtrace_str", "metadata": "root.TestSimpleMemory.line_trace", "header": "['class', 'TestSimpleMemory', '(', 'Model', ')', ':', '___NEWLINE___', '___NL___', '#-----------------------------------------------------------------------', '___NL___', '# Constructor', '___NL___', '#-----------------------------------------------------------------------', '___NL___', '___EOS___']", "index": 186 }, { "content": " def load_memory( s, section_list ):\n\n section_addr = section_list[0]\n section_data = section_list[1]\n section_len = len( section_data )\n\n #print(section_addr)\n #print(section_data)\n #print(section_len)\n\n assert len(s.mem) > (section_addr + section_len)\n s.mem[ section_addr : section_addr + section_len ] = section_data", "metadata": "root.TestSimpleMemory.load_memory", "header": "['class', 'TestSimpleMemory', '(', 'Model', ')', ':', '___NEWLINE___', '___NL___', '#-----------------------------------------------------------------------', '___NL___', '# Constructor', '___NL___', '#-----------------------------------------------------------------------', '___NL___', '___EOS___']", "index": 203 } ]
[ { "span": "def __init__( s, memreq_params, memresp_params, nports,\n mem_nbytes=2**20 ):", "start_line": 20, "start_column": 2, "end_line": 21, "end_column": 35 }, { "span": "def line_trace( s ):", "start_line": 186, "start_column": 2, "end_line": 186, "end_column": 22 }, { "span": "def load_memory( s, section_list ):", "start_line": 203, "start_column": 2, "end_line": 203, "end_column": 37 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Test", "Simple", "Memory_", "(_", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Constructor", "_", "\\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\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "s_", ",_", "mem", "req", "\\u", "params_", ",_", "mem", "resp", "\\u", "params_", ",_", "npo", "rts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mem", "\\u", "nbytes_", "=_", "2_", "**_", "20_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Local", " ", "constant", " ", "-", " ", "store", " ", "the", " ", "number", " ", "of", " ", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req", "\\u", "nbi", "ts_", "=_", "mem", "req", "\\u", "params_", "._", "nbi", "ts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp", "\\u", "nbi", "ts_", "=_", "mem", "resp", "\\u", "params_", "._", "nbi", "ts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "memory", " ", "request", " ", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "reqs_", "=_", "[_", "In", "Val", "Rd", "y", "Bundle_", "(_", "req", "\\u", "nbi", "ts_", ")_", "for_", "\\u_", "in_", "range_", "(_", "npo", "rts_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "memory", " ", "response", " ", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "resp", "s_", "=_", "[_", "Out", "Val", "Rd", "y", "Bundle_", "(_", "resp", "\\u", "nbi", "ts_", ")_", "for_", "\\u_", "in_", "range_", "(_", "npo", "rts_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Memo", "ry", " ", "message", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "mem", "req", "\\u", "params_", "=_", "mem", "req", "\\u", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "mem", "resp", "\\u", "params_", "=_", "mem", "resp", "\\u", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "s_", "._", "mem", "req", "\\u", "params_", "._", "data\\u", "nbi", "ts_", "%_", "8_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "s_", "._", "mem", "resp", "\\u", "params_", "._", "data\\u", "nbi", "ts_", "%_", "8_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "Unpack", " ", "models_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "mem", "req_", "=_", "[_", "mem", "\\u", "msgs_", "._", "Mem", "Re", "q", "Fro", "m", "Bits_", "(_", "mem", "req", "\\u", "params_", ")_", "for_", "\\u_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "range_", "(_", "npo", "rts_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "Pack", " ", "models_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "mem", "resp_", "=_", "[_", "mem", "\\u", "msgs_", "._", "Mem", "Resp", "To", "Bits_", "(_", "mem", "resp", "\\u", "params_", ")_", "for_", "\\u_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "range_", "(_", "npo", "rts_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "mem", "\\u", "nbytes_", "=_", "mem", "\\u", "nbytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Connectivity", " ", "and", " ", "Logic_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Buffers", " ", "to", " ", "hold", " ", "memory", " ", "request", " ", "messages_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "mem", "req", "\\u", "type_", "=_", "[_", "Bits_", "(_", "1_", ")_", "for_", "\\u_", "in_", "range_", "(_", "npo", "rts_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "mem", "req", "\\u", "addr_", "=_", "[_", "Bits_", "(_", "32_", ")_", "for_", "\\u_", "in_", "range_", "(_", "npo", "rts_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "mem", "req", "\\u", "len_", "=_", "[_", "Bits_", "(_", "2_", ")_", "for_", "\\u_", "in_", "range_", "(_", "npo", "rts_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "mem", "req", "\\u", "data_", "=_", "[_", "Bits_", "(_", "32_", ")_", "for_", "\\u_", "in_", "range_", "(_", "npo", "rts_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "mem", "req", "\\u", "full_", "=_", "[_", "Wire", "_", "(_", "1_", ")_", "for_", "\\u_", "in_", "range_", "(_", "npo", "rts_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Actual", " ", "memory_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "mem_", "=_", "bytearray_", "(_", "s_", "._", "mem", "\\u", "nbytes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Connect", " ", "mem", "req", "\\u", "msg", " ", "port", " ", "list", " ", "to", " ", "Unpack", " ", "port", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "npo", "rts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "connect_", "(_", "s_", "._", "reqs_", "[_", "i_", "]_", "._", "msg_", ",_", "s_", "._", "mem", "req_", "[_", "i_", "]_", "._", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Connect", " ", "mem", "resp", "\\u", "msg", " ", "port", " ", "list", " ", "to", " ", "Pack", " ", "port", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "npo", "rts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "connect_", "(_", "s_", "._", "resp", "s_", "[_", "i_", "]_", "._", "msg_", ",_", "s_", "._", "mem", "resp_", "[_", "i_", "]_", "._", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tic", "k_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "s_", "._", "pose", "dge", "\\u", "clk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "tick_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Iterat", "e", " ", "over", " ", "the", " ", "port", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "npo", "rts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "At", " ", "the", " ", "end", " ", "of", " ", "the", " ", "cycle", ",", " ", "we", " ", "AND", " ", "tog", "ether", " ", "the", " ", "val", "/", "rd", "y", " ", "bits", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "if", " ", "the", " ", "request", "/", "mem", "resp", " ", "message", " ", "transaction", "s", " ", "occure", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "mem", "req", "\\u", "go_", "=_", "s_", "._", "reqs_", "[_", "i_", "]_", "._", "val_", "and_", "s_", "._", "reqs_", "[_", "i_", "]_", "._", "rd", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "mem", "resp", "\\u", "go_", "=_", "s_", "._", "resp", "s_", "[_", "i_", "]_", "._", "val_", "and_", "s_", "._", "resp", "s_", "[_", "i_", "]_", "._", "rd", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "mem", "resp", " ", "transaction", " ", "occure", "d", ",", " ", "then", " ", "clear", " ", "the", " ", "buffer", " ", "full", " ", "bit", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "we", " ", "do", " ", "this", " ", "\\u", "first", "\\u", " ", "bef", "ore", " ", "we", " ", "process", " ", "the", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "transaction", " ", "so", " ", "we", " ", "can", " ", "essential", "ly", " ", "pipeline", " ", "this", " ", "control", " ", "logic", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "s_", "._", "mem", "resp", "\\u", "go_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "mem", "req", "\\u", "full_", "[_", "i_", "]_", "._", "next_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "request", " ", "transaction", " ", "occure", "d", ",", " ", "then", " ", "write", " ", "the", " ", "request", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "int", "o", " ", "our", " ", "internal", " ", "buffer", " ", "and", " ", "update", " ", "the", " ", "buffer", " ", "full", " ", "bit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "s_", "._", "mem", "req", "\\u", "go_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "mem", "req", "\\u", "full_", "[_", "i_", "]_", "._", "next_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "mem", "req", "\\u", "type_", "[_", "i_", "]_", "=_", "s_", "._", "mem", "req_", "[_", "i_", "]_", "._", "type\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "mem", "req", "\\u", "addr_", "[_", "i_", "]_", "=_", "s_", "._", "mem", "req_", "[_", "i_", "]_", "._", "addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "mem", "req", "\\u", "len_", "[_", "i_", "]_", "=_", "s_", "._", "mem", "req_", "[_", "i_", "]_", "._", "len", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "mem", "req", "\\u", "data_", "[_", "i_", "]_", "=_", "s_", "._", "mem", "req_", "[_", "i_", "]_", "._", "data_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "len", " ", "is", " ", "zero", ",", " ", "then", " ", "we", " ", "use", " ", "all", " ", "of", " ", "the", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nbytes_", "=_", "s_", "._", "mem", "req", "\\u", "len_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "._", "mem", "req", "\\u", "len_", "[_", "i_", "]_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nbytes_", "=_", "s_", "._", "mem", "req", "\\u", "params_", "._", "data\\u", "nbi", "ts_", "/_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Handle", " ", "a", " ", "read", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "s_", "._", "mem", "req", "\\u", "type_", "[_", "i_", "]_", "==_", "s_", "._", "mem", "req", "\\u", "params_", "._", "type", "\\u", "read_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", " ", "the", " ", "bytes", " ", "from", " ", "the", " ", "bytea", "rray", " ", "int", "o", " ", "read", " ", "data", " ", "bits_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "\\u", "data_", "=_", "Bits_", "(_", "s_", "._", "mem", "req", "\\u", "params_", "._", "data\\u", "nbi", "ts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "nbytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "\\u", "data_", "[_", "j_", "*_", "8_", ":_", "j_", "*_", "8_", "+_", "8_", "]_", "=_", "s_", "._", "mem_", "[_", "s_", "._", "mem", "req", "\\u", "addr_", "[_", "i_", "]_", "+_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "response", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "._", "mem", "resp_", "[_", "i_", "]_", "._", "type\\u_", "._", "next_", "=_", "s_", "._", "mem", "resp", "\\u", "params_", "._", "type", "\\u", "read_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "mem", "resp_", "[_", "i_", "]_", "._", "len", "\\u_", "._", "next_", "=_", "s_", "._", "mem", "req", "\\u", "len_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "mem", "resp_", "[_", "i_", "]_", "._", "data_", "._", "next_", "=_", "read", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Handle", " ", "a", " ", "write", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "._", "mem", "req", "\\u", "type_", "[_", "i_", "]_", "==_", "s_", "._", "mem", "req", "\\u", "params_", "._", "type", "\\u", "write_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", " ", "write", " ", "data", " ", "bits", " ", "int", "o", " ", "bytearray_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "data_", "=_", "s_", "._", "mem", "req", "\\u", "data_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "nbytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "mem_", "[_", "s_", "._", "mem", "req", "\\u", "addr_", "[_", "i_", "]_", "+_", "j_", "]_", "=_", "write", "\\u", "data_", "[_", "j_", "*_", "8_", ":_", "j_", "*_", "8_", "+_", "8_", "]_", "._", "uint_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "response", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "._", "mem", "resp_", "[_", "i_", "]_", "._", "type\\u_", "._", "next_", "=_", "s_", "._", "mem", "resp", "\\u", "params_", "._", "type", "\\u", "write_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "mem", "resp_", "[_", "i_", "]_", "._", "len", "\\u_", "._", "next_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "mem", "resp_", "[_", "i_", "]_", "._", "data_", "._", "next_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "some", " ", "reason", " ", "this", " ", "is", " ", "caus", "ing", " ", "an", " ", "assert", " ", "in", " ", "Py", "MT", "L", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "assert", " ", "Tru", "e", ",", " ", "\"", "Unre", "cogni", "zed", " ", "request", " ", "message", " ", "type", "!", " ", "{}", "\"", " ", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ".", "format", "(", " ", "s", ".", "mem", "req", "\\u", "type", "[", "i", "]", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Combinat", "ional", " ", "Logic_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "model", " ", "the", " ", "Test", "Simple", "Memo", "ry", " ", "to", " ", "behave", " ", "like", " ", "a", " ", "normal", " ", "queue", ".", " ", "Ins", "tea", "d", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "combinat", "ional", "ly", " ", "hook", "ing", " ", "up", " ", "the", " ", "mem", "resp", "\\u", "rd", "y", " ", "to", " ", "mem", "req", "\\u", "rd", "y", ",", " ", "we", " ", "see", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", " ", "is", " ", "anyt", "hing", " ", "presen", "t", " ", "in", " ", "the", " ", "buffer", " ", "or", " ", "not", ",", " ", "to", " ", "calcul", "ate", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", "y", " ", "signal", "._", "\\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_", "@_", "s_", "._", "combinat", "ional", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "comb_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Iterat", "e", " ", "over", " ", "the", " ", "port", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "npo", "rts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "reqs_", "[_", "i_", "]_", "._", "rd", "y_", "._", "value_", "=_", "(_", "not_", "s_", "._", "mem", "req", "\\u", "full_", "[_", "i_", "]_", "or_", "s_", "._", "resp", "s_", "[_", "i_", "]_", "._", "rd", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "resp", "s_", "[_", "i_", "]_", "._", "val_", "._", "value_", "=_", "s_", "._", "mem", "req", "\\u", "full_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Memory_", "(_", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Constructor", "_", "\\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_", "def_", "line", "\\u", "trace_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mem", "trace", "\\u", "str_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "req_", ",_", "resp_", "in_", "zip_", "(_", "s_", "._", "reqs_", ",_", "s_", "._", "resp", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mem", "trace", "\\u", "str_", "+=_", "\"|", "{}", " ", "()", " ", "{}\"_", "._", "format_", "(_", "req_", ",_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "mem", "trace", "\\u", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Memory_", "(_", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Constructor", "_", "\\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_", "load", "\\u", "memory_", "(_", "s_", ",_", "section", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "section", "\\u", "addr_", "=_", "section", "\\u", "list_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section", "\\u", "data_", "=_", "section", "\\u", "list_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section", "\\u", "len_", "=_", "len_", "(_", "section", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", "(", "section", "\\u", "addr", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", "(", "section", "\\u", "data", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", "(", "section", "\\u", "len", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "s_", "._", "mem_", ")_", ">_", "(_", "section", "\\u", "addr_", "+_", "section", "\\u", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "mem_", "[_", "section", "\\u", "addr_", ":_", "section", "\\u", "addr_", "+_", "section", "\\u", "len_", "]_", "=_", "section", "\\u", "data_" ]
[ 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
cimatosa/jobmanager/jobmanager/binfootprint.py
[ { "content": "def _dump_spec(ob):\n if ob == True:\n b = init_BYTES([_SPEC, char_to_byte('T')])\n elif ob == False:\n b = init_BYTES([_SPEC, char_to_byte('F')])\n elif ob == None:\n b = init_BYTES([_SPEC, char_to_byte('N')])\n else:\n raise RuntimeError(\"object is not of 'special' kind!\") \n return b", "metadata": "root._dump_spec", "header": "['module', '___EOS___']", "index": 137 } ]
[ { "span": "ob == None:", "start_line": 142, "start_column": 9, "end_line": 142, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "dump", "\\u", "spec_", "(_", "ob_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ob_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "init", "\\u", "BYTES_", "(_", "[_", "\\u", "SPEC", "_", ",_", "char", "\\u", "to", "\\u", "byte_", "(_", "'", "T", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ob_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "init", "\\u", "BYTES_", "(_", "[_", "\\u", "SPEC", "_", ",_", "char", "\\u", "to", "\\u", "byte_", "(_", "'", "F", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ob_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "init", "\\u", "BYTES_", "(_", "[_", "\\u", "SPEC", "_", ",_", "char", "\\u", "to", "\\u", "byte_", "(_", "'", "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 ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "object", " ", "is", " ", "not", " ", "of", " ", "'", "special", "'", " ", "kind", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "b_", "\\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, 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 ]
Unused import
rusthon/Rusthon/rusthon.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n__version__ = '0.9.9'\nimport os, sys, subprocess, hashlib, time\nimport tempfile\nimport webbrowser\n\n## if installed as a symbolic link, this ensures things can still be bootstrapped from the `src` subfolder\nRUSTHON_LIB_ROOT = os.path.dirname(unicode(os.path.realpath(__file__), sys.getfilesystemencoding()))\n\n\nGO_EXE = None\nif os.path.isfile('/usr/bin/go'):\n\tGO_EXE = '/usr/bin/go'\nelif os.path.isfile('/usr/local/go/bin/go'):\n\tGO_EXE = '/usr/local/go/bin/go'\nelif os.path.isfile(os.path.expanduser('~/go/bin/go')):\n\tGO_EXE = os.path.expanduser('~/go/bin/go')\n\nnodewebkit_runnable = False\nnodewebkit = os.path.expanduser('~/nwjs-v0.12.2-linux-x64/nw')\nif os.path.isfile( nodewebkit ): nodewebkit_runnable = True\nelse:\n\tnodewebkit = os.path.expanduser('~/nwjs-v0.12.3-linux-x64/nw')\n\tif os.path.isfile( nodewebkit ): nodewebkit_runnable = True\n\nif sys.platform=='darwin':\n\tnodewebkit = os.path.expanduser('~/nwjs-v0.12.3-osx-x64/nwjs.app/Contents/MacOS/nwjs')\n\tif os.path.isfile( nodewebkit ):\n\t\tnodewebkit_runnable = True\n\n\n## special case for linux, just for debugging, look for google-chrome,\n## if found then use it to launch tests, with the --disable-gpu-sandbox\n## otherwise webgl may fail on some graphics cards, this is dangerous\n## and can lockup the desktop, this was an issue on Fedora21 with intel graphics,\n## but is no longer an issue in Fedora22. Enable this at your own risk.\nCHROME_EXE = None\n#if os.path.isfile('/opt/google/chrome-unstable/google-chrome-unstable'):\n#\tCHROME_EXE = '/opt/google/chrome-unstable/google-chrome-unstable'\n#elif os.path.isfile('/opt/google/chrome-beta/google-chrome-beta'):\n#\tCHROME_EXE = '/opt/google/chrome-beta/google-chrome-beta'\n#elif os.path.isfile('/opt/google/chrome/google-chrome'):\n#\tCHROME_EXE = '/opt/google/chrome/google-chrome'\n\n## on fedora nodejs command is `node`, but on others it can be `nodejs`\nnodejs_exe = 'node'\nif os.path.isfile('/usr/sbin/ax25-node'):\n\tif os.path.isfile('/usr/sbin/node'):\n\t\tif os.path.realpath('/usr/sbin/node') == '/usr/sbin/ax25-node':\n\t\t\tnodejs_exe = 'nodejs'\n\nJS_WEBWORKER_HEADER = u'''\nvar __$UID$__ = 1;\nvar __construct__ = function(constructor, args) {\n\tfunction F() {\n\t\treturn constructor.apply(this, args);\n\t}\n\tF.prototype = constructor.prototype;\n\treturn new F();\n};\n\nvar __instances__ = {};\nvar __bin__ = null;\nself.onmessage = function (evt) {\n\tvar id;\n\tif (__bin__) {\n\t\tvar bmsg;\n\t\tif (__bin__.type==\"Float32Array\") {\n\t\t\tbmsg = new Float32Array(evt.data);\n\t\t} else if (__bin__.type==\"Float64Array\") {\n\t\t\tbmsg = new Float64Array(evt.data);\n\t\t} // TODO other types\n\n\t\tif (__bin__.send_binary) {\n\t\t\tid = __bin__.send_binary;\n\t\t\tvar ob = __instances__[id];\n\t\t\tvar re = ob.send(bmsg);\n\t\t\tif (re !== undefined) {\n\t\t\t\tif (ob.send.returns==\"Float32Array\") {\n\t\t\t\t\tself.postMessage({'id':id, 'bin':ob.send.returns});\n\t\t\t\t\tself.postMessage(re.buffer, [re.buffer]);\n\t\t\t\t} else {\n\t\t\t\t\tself.postMessage({'id':id, 'message':re, 'proto':ob.send.returns});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t__bin__ = null;\n\t\treturn;\n\t}\n\tvar msg = evt.data;\n\n\tif (msg.send_binary) {\n\t\t// should assert here that __bin__ is null\n\t\t__bin__ = msg;\n\t\treturn;\n\t}\n\tif (msg['spawn']) {\n\t\tid = msg.spawn;\n\t\tself.postMessage({debug:\"SPAWN:\"+id});\n\t\tif (__instances__[id] !== undefined) {\n\t\t\tself.postMessage({debug:\"SPAWN ERROR - existing id:\"+id});\n\n\t\t}\n\t\t//self.postMessage({debug:\"SPAWN-CLASS:\"+msg['new']});\n\t\t//self.postMessage({debug:\"SPAWN-ARGS:\"+msg['args']});\n\t\t__instances__[id] = __construct__(eval(msg['new']), msg.args );\n\t\t__instances__[id].__uid__ = id;\n\t}\n\tif (msg['send']) {\n\t\tid = msg.send;\n\t\t//self.postMessage({debug:\"SEND:\"+id});\n\t\tvar ob = __instances__[id];\n\t\tvar re = ob.send(msg.message);\n\t\tif (re !== undefined) {\n\t\t\t//self.postMessage({debug:\"SEND-BACK:\"+re});\n\t\t\tself.postMessage({'id':id, 'message':re, 'proto':ob.send.returns});\n\t\t} else {\n\t\t\t//self.postMessage({debug:\"SEND-BACK-NONE:\"});\n\t\t}\n\t}\n\tif (msg['call']) {\n\t\tself.postMessage({\n\t\t\t'CALL' : 1, \n\t\t\t'message': self[ msg.call ].apply(null,msg.args),\n\t\t\t'proto' : self[ msg.call ].returns\n\t\t});\n\t}\n\tif (msg['callmeth']) {\n\t\tid = msg.id;\n\t\t//self.postMessage({debug:\"CALLM:\"+id});\n\t\tvar ob = __instances__[id];\n\t\tif (typeof(ob) == \"undefined\") {\n\t\t\tself.postMessage({debug:\"invalid spawn instance id:\"+id});\n\t\t\tself.postMessage({debug:\"instances:\"+Object.keys(__instances__).length});\n\t\t} else {\n\t\t\tself.postMessage({\n\t\t\t\t'CALLMETH': 1, \n\t\t\t\t'message' : ob[msg.callmeth].apply(ob,msg.args),\n\t\t\t\t'proto' : ob[msg.callmeth].returns\n\t\t\t});\n\n\t\t}\n\t}\n\n\tif (msg['get']) {\n\t\tid = msg.id;\n\t\t//self.postMessage({debug:\"GET:\"+id});\n\t\tvar ob = __instances__[id];\n\t\tself.postMessage({'GET':1, 'message':ob[msg.get]});\n\t}\n\n}\n'''\n\nOPENSHIFT_PY = [\nu'''#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport os\n\nvirtenv = os.environ['OPENSHIFT_PYTHON_DIR'] + '/virtenv/'\nvirtualenv = os.path.join(virtenv, 'bin/activate_this.py')\ntry:\n execfile(virtualenv, dict(__file__=virtualenv))\nexcept IOError:\n pass\n#\n# IMPORTANT: Put any additional includes below this line. If placed above this\n# line, it's possible required libraries won't be in your searchable path\n#\nfrom base64 import b64decode\nINDEX_HTML = b64decode(\"%s\")\n''', ## header\n\nu'''\ndef application(environ, start_response):\n\n ctype = 'text/plain'\n if environ['PATH_INFO'] == '/health':\n response_body = \"1\"\n elif environ['PATH_INFO'] == '/env':\n response_body = ['%s: %s' % (key, value)\n for key, value in sorted(environ.items())]\n response_body = '\\\\n'.join(response_body)\n else:\n ctype = 'text/html'\n response_body = INDEX_HTML\n\n status = '200 OK'\n response_headers = [('Content-Type', ctype), ('Content-Length', str(len(response_body)))]\n #\n start_response(status, response_headers)\n return [response_body]\n\n#\n# Below for testing only\n#\nif __name__ == '__main__':\n from wsgiref.simple_server import make_server\n httpd = make_server('localhost', 8051, application)\n # Wait for a single request, serve it and quit.\n httpd.handle_request()\n''']\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nGITCACHE = os.path.expanduser('~/rusthon_cache')\n\n\n\n\n\n## this hack to force the devtools window to show first will not work because a body onload will execute\n## at the same time and the js debugger will also reload,\n## but because the debugger is in another process, it will the first debug events.\nNW_DEVTOOLS_HACK = '''\n<html>\n<script>\nrequire('nw.gui').Window.get().showDevTools();\nsetTimeout(function (){\n\t\t//require('nw.gui').Window.get().reloadDev();\n\t\trequire('nw.gui').Window.get().reload();\n\t},\n\t3000\n);\n</script>\n<body>opening devtools window....</body>\n</html>\n'''\n\nNW_STARTUP_HACK = '''\nexports.myinit = function() {\n\trequire('nw.gui').Window.get().showDevTools();\n}\n\n'''\n\n\nBOOTSTRAPED = None\n\n\n\n#MAIN#\nif __name__ == \"__main__\":\n\tbootstrap_rusthon()\n\tmain()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def compile_js( script, module_path, main_name='main', directjs=False, directloops=False ):\n\t'''\n\tdirectjs = False ## compatible with pythonjs-minimal.js\n\tdirectloops = False ## allows for looping over strings, arrays, hmtlElements, etc. if true outputs cleaner code.\n\t'''\n\tfastjs = True ## this is now the default, and complete python mode is deprecated\n\tresult = {}\n\n\tpyjs = python_to_pythonjs(\n\t\tscript,\n\t\tmodule_path=module_path,\n\t\tfast_javascript = fastjs,\n\t\tpure_javascript = directjs\n\t)\n\n\tif isinstance(pyjs, dict): ## split apart by webworkers\n\t\tworkers = []\n\t\tmainjs = None\n\t\tfor jsfile in pyjs:\n\t\t\tjs = translate_to_javascript(\n\t\t\t\tpyjs[jsfile],\n\t\t\t\twebworker=jsfile == 'worker.js',\n\t\t\t\trequirejs=False,\n\t\t\t\tinsert_runtime=False,\n\t\t\t\tfast_javascript = fastjs,\n\t\t\t\tfast_loops = directloops,\n\t\t\t\truntime_checks = '--release' not in sys.argv\n\t\t\t)\n\t\t\tresult[ jsfile ] = js\n\t\t\tif jsfile == 'worker.js':\n\t\t\t\tworkers.append(js)\n\t\t\telse:\n\t\t\t\tmainjs = jsfile\n\n\t\tsrc = [ 'var __workersrc__ = [' ]\n\t\ta = JS_WEBWORKER_HEADER.encode('utf-8') + workers[0]\n\t\tfor line in a.strip().splitlines():\n\t\t\tsrc.append(\t'\"%s\\\\n\",' % line.replace('\"', '\\\\\"'))\n\t\tsrc.append(']')\n\t\tsrc.append(result[mainjs])\n\t\tresult[mainjs] = '\\n'.join(src)\n\n\telse:\n\n\t\tcode = translate_to_javascript(\n\t\t\tpyjs,\n\t\t\tas_module='--ES6-module' in sys.argv,\n\t\t\trequirejs=False,\n\t\t\tinsert_runtime=False,\n\t\t\tfast_javascript = fastjs,\n\t\t\tfast_loops = directloops,\n\t\t\truntime_checks = '--release' not in sys.argv\n\t\t)\n\t\tif isinstance(code, dict):\n\t\t\tresult.update( code )\n\t\telse:\n\t\t\tresult['main'] = code\n\n\tif main_name != 'main':\n\t\t#assert main_name.endswith('.js') ## allow tag names\n\t\tresult[main_name] = result.pop('main')\n\n\treturn result", "metadata": "root.compile_js", "header": "['module', '___EOS___']", "index": 207 }, { "content": "def compile_java( javafiles ):\n\tassert 'JAVA_HOME' in os.environ\n\ttmpdir = tempfile.gettempdir()\n\tcmd = ['javac']\n\tcmd.extend( javafiles )\n\tprint(' '.join(cmd))\n\tsubprocess.check_call(cmd, cwd=tmpdir)\n\tclassfiles = [jfile.replace('.java', '.class') for jfile in javafiles]\n\tcmd = ['jar', 'cvf', 'mybuild.jar']\n\tcmd.extend( classfiles )\n\tprint(' '.join(cmd))\n\tsubprocess.check_call(cmd, cwd=tmpdir)\n\tjarfile = os.path.join(tmpdir,'mybuild.jar')\n\tassert os.path.isfile(jarfile)\n\treturn {'class-files':classfiles, 'jar':jarfile}", "metadata": "root.compile_java", "header": "['module', '___EOS___']", "index": 271 }, { "content": "def compile_giws_bindings( xml ):\n\ttmpdir = tempfile.gettempdir()\n\ttmpfile = os.path.join(tmpdir, 'rusthon_giws.xml')\n\topen(tmpfile, 'wb').write(xml)\n\tcmd = [\n\t\t'giws',\n\t\t'--description-file='+tmpfile,\n\t\t'--output-dir='+tmpdir,\n\t\t#'--per-package',\n\t\t'--disable-return-size-array',\n\t\t#'--throws-exception-on-error', # requires GiwsException.hxx and GiwsException.cpp\n\t]\n\t#subprocess.check_call(cmd)\n\tproc = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)\n\tproc.wait()\n\tif proc.returncode:\n\t\traise RuntimeError(proc.stderr.read())\n\telse:\n\t\theaders = []\n\t\timpls = []\n\t\tfor line in proc.stdout.read().splitlines():\n\t\t\tif line.endswith(' generated ...'): ## TODO something better\n\t\t\t\tname = line.split()[0]\n\t\t\t\tif name.endswith('.hxx'):\n\t\t\t\t\theaders.append( name )\n\t\t\t\telif name.endswith('.cpp'):\n\t\t\t\t\timpls.append( name )\n\n\t\tcode = []\n\t\tfor header in headers:\n\t\t\tdata = open(os.path.join(tmpdir,header), 'rb').read()\n\t\t\tcode.append( data )\n\n\t\tfor impl in impls:\n\t\t\tdata = open(os.path.join(tmpdir,impl), 'rb').read()\n\t\t\tlines = ['/* %s */' %impl]\n\t\t\tincludes = [] ## ignore these\n\t\t\tfor line in data.splitlines():\n\t\t\t\tif line.startswith('#include'):\n\t\t\t\t\tincludes.append(line)\n\t\t\t\telse:\n\t\t\t\t\tlines.append(line)\n\t\t\tcode.append( '\\n'.join(lines) )\n\n\t\treturn '\\n'.join(code)", "metadata": "root.compile_giws_bindings", "header": "['module', '___EOS___']", "index": 288 }, { "content": "def java_to_rusthon( input ):\n\tj2pybin = 'j2py'\n\tif os.path.isfile(os.path.expanduser('~/java2python/bin/j2py')):\n\t\tj2pybin = os.path.expanduser('~/java2python/bin/j2py')\n\tprint('======== %s : translate to rusthon' %j2pybin)\n\tj2py = subprocess.Popen([j2pybin, '--rusthon'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)\n\tstdout,stderr = j2py.communicate( input )\n\tif stderr: raise RuntimeError(stderr)\n\tif j2py.returncode: raise RuntimeError('j2py error!')\n\tprint(stdout)\n\tprint('---------------------------------')\n\trcode = typedpython.transform_source(stdout.replace(' ', '\\t'))\n\tprint(rcode)\n\tprint('---------------------------------')\n\treturn rcode", "metadata": "root.java_to_rusthon", "header": "['module', '___EOS___']", "index": 334 }, { "content": "def new_module():\n\treturn {\n\t\t'markdown': '',\n\t\t'coffee' : [],\n\t\t'python' : [],\n\t\t'rusthon' : [],\n\t\t'rust' : [],\n\t\t'elm' : [],\n\t\t'c' : [],\n\t\t'c++' : [],\n\t\t'c#' : [],\n\t\t'go' : [],\n\t\t'html' : [],\n\t\t'verilog' : [],\n\t\t'bash' : [],\n\t\t'java' : [],\n\t\t'nim' : [],\n\t\t'xml' : [],\n\t\t'json' : [],\n\t\t'bazel' : [],\n\t\t'gyp' : [],\n\t\t'rapydscript':[],\n\t\t'javascript':[],\n\t}", "metadata": "root.new_module", "header": "['module', '___EOS___']", "index": 353 }, { "content": "def import_md( url, modules=None, index_offset=0, force_tagname=None ):\n\tassert modules is not None\n\tdoc = []\n\tcode = []\n\tcode_links = []\n\tcode_idirs = []\n\tcode_defines = []\n\tlang = False\n\tin_code = False\n\tindex = 0\n\tprevline = None\n\ttag = force_tagname or None\n\tfences = 0\n\tbase_path, markdown_name = os.path.split(url)\n\t#data = open(url, 'rb').read().decode('utf-8')\n\timport codecs\n\tdata = codecs.open(url, 'r', 'utf-8').read()\n\n\tfor line in data.splitlines():\n\t\tif line.startswith('* @link:'):\n\t\t\tcode_links.append( os.path.expanduser(line.split(':')[-1]) )\n\t\telif line.startswith('* @include:'):\n\t\t\tcode_idirs.append( os.path.expanduser(line.split(':')[-1]) )\n\t\telif line.startswith('* @define:'):\n\t\t\tcode_defines.extend( line.split(':')[-1].strip().split() )\n\t\t# Start or end of a code block.\n\t\telif line.strip().startswith('```'):\n\t\t\tfences += 1\n\t\t\t# End of a code block.\n\t\t\tif in_code:\n\t\t\t\tif lang:\n\t\t\t\t\tif lang=='python' and 'from rusthon import *' in code:\n\t\t\t\t\t\trusthonpy = []\n\t\t\t\t\t\tfor rln in open(__file__, 'rb').read().splitlines():\n\t\t\t\t\t\t\tif rln == 'if __name__ == \"__main__\":':\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\telse:\n\t\t\t\t\t\t\t\trusthonpy.append(rln)\n\t\t\t\t\t\trusthonpy = '\\n'.join(rusthonpy)\n\t\t\t\t\t\tutfheader = u'# -*- coding: utf-8 -*-\\n'\n\t\t\t\t\t\tcode.insert(0, utfheader + BOOTSTRAPED + '\\n' + rusthonpy.decode('utf-8'))\n\t\t\t\t\t\tcode.pop(code.index('from rusthon import *'))\n\n\t\t\t\t\tp, n = os.path.split(url)\n\t\t\t\t\tmod = {\n\t\t\t\t\t\t'path':p, \n\t\t\t\t\t\t'markdown':url, \n\t\t\t\t\t\t'code':'\\n'.join(code), \n\t\t\t\t\t\t'index':index+index_offset, \n\t\t\t\t\t\t'tag':tag,\n\t\t\t\t\t\t'links':code_links,\n\t\t\t\t\t\t'include-dirs':code_idirs,\n\t\t\t\t\t\t'defines':code_defines,\n\t\t\t\t\t}\n\t\t\t\t\tif tag and '.' in tag:\n\t\t\t\t\t\text = tag.split('.')[-1].lower()\n\t\t\t\t\t\t#if ext in 'xml html js css py c cs h cpp hpp rust go java json'.split():\n\t\t\t\t\t\tmod['name'] = tag\n\n\t\t\t\t\tmodules[ lang ].append( mod )\n\t\t\t\tin_code = False\n\t\t\t\tcode = []\n\t\t\t\tcode_links = []\n\t\t\t\tcode_idirs = []\n\t\t\t\tindex += 1\n\t\t\t# Start of a code block.\n\t\t\telse:\n\t\t\t\tin_code = True\n\t\t\t\tif prevline and prevline.strip().startswith('@'):\n\t\t\t\t\ttag = prevline.strip()[1:]\n\t\t\t\telse:\n\t\t\t\t\ttag = None\n\n\t\t\t\tlang = line.strip().split('```')[-1]\n\t\t# The middle of a code block.\n\t\telif in_code:\n\t\t\tcode.append(line)\n\t\telse:\n\t\t\t## import submarkdown file ##\n\t\t\tif line.startswith('* ') and '@import' in line and line.count('[')==1 and line.count(']')==1 and line.count('(')==1 and line.count(')')==1:\n\t\t\t\tsubmarkdown = line.split('(')[-1].split(')')[0].strip()\n\t\t\t\tsubpath = os.path.join(base_path, submarkdown)\n\t\t\t\tif not os.path.isfile(subpath):\n\t\t\t\t\traise RuntimeError('error: can not find markdown file: '+subpath)\n\t\t\t\t#print 'importing submarkdown'\n\t\t\t\t#print subpath\n\t\t\t\tindex += import_md( subpath, modules, index_offset=index )\n\n\t\t\tdoc.append(line)\n\n\t\tprevline = line\n\n\tmodules['markdown'] += '\\n'.join(doc)\n\tif fences % 2:\n\t\traise SyntaxError('invalid markdown - unclosed tripple back quote fence in: %s' %url)\n\n\n\treturn index", "metadata": "root.import_md", "header": "['module', '___EOS___']", "index": 378 }, { "content": "def hack_nim_stdlib(code):\n\t'''\n\talready talked to the nim guys in irc, they dont know why these dl functions need to be stripped\n\t'''\n\tout = []\n\tfor line in code.splitlines():\n\t\tif 'dlclose(' in line or 'dlopen(' in line or 'dlsym(' in line:\n\t\t\tpass\n\t\telse:\n\t\t\tout.append( line )\n\treturn '\\n'.join(out)", "metadata": "root.hack_nim_stdlib", "header": "['module', '___EOS___']", "index": 477 }, { "content": "def is_restricted_bash( line ):\n\tif '&&' in line:\n\t\treturn False\n\tif \"`\" in line:\n\t\treturn False\n\tif '\"' in line:\n\t\treturn False\n\n\tokcmds = [\n\t\t'./configure', \n\t\t'make', 'cmake', \n\t\t'scons', 'bazel', \n\t\t'cd', 'mkdir', 'cp', #'pwd', 'ls',\n\t\t'npm', 'grunt', 'gyp', 'nw-gyp',\n\t\t'apt-get', 'yum',\n\t\t'pip', 'docker', 'rhc',\n\t]\n\tcmd = line.split()[0]\n\tif cmd == 'sudo': cmd = line.split()[1]\n\n\tif cmd in okcmds:\n\t\treturn True\n\telse:\n\t\treturn False", "metadata": "root.is_restricted_bash", "header": "['module', '___EOS___']", "index": 490 }, { "content": "def build( modules, module_path, datadirs=None ):\n\tif '--debug-build' in sys.argv:\n\t\traise RuntimeError(modules)\n\toutput = {'executeables':[], 'rust':[], 'c':[], 'c++':[], 'c#':[], 'go':[], 'javascript':[], 'java':[], 'xml':[], 'json':[], 'python':[], 'html':[], 'verilog':[], 'nim':[], 'lua':[], 'dart':[], 'datadirs':datadirs, 'datafiles':{}}\n\tpython_main = {'name':'main.py', 'script':[]}\n\tgo_main = {'name':'main.go', 'source':[]}\n\ttagged = {}\n\tlink = []\n\tgiws = [] ## xml jni generator so c++ can call into java, blocks tagged with @gwis are compiled and linked with the final exe.\n\tjava2rusthon = []\n\tnim_wrappers = []\n\tlibdl = False ## provides: dlopen, dlclose, for dynamic libs. Nim needs this\n\tcached_json = {}\n\tgyp_builds = {}\n\n\tif modules['bash']:\n\t\tfor mod in modules['bash']:\n\t\t\tif 'tag' in mod and mod['tag']:\n\t\t\t\ttag = mod['tag']\n\t\t\t\tif tag.startswith('http://') or tag.startswith('https://'):\n\t\t\t\t\tif not tag.endswith('.git'):\n\t\t\t\t\t\traise SyntaxError('only git repos links are allowed: '+tag)\n\t\t\t\t\tif not os.path.isdir(GITCACHE):\n\t\t\t\t\t\tprint 'making new rusthon cache folder: ' + GITCACHE\n\t\t\t\t\t\tos.mkdir(GITCACHE)\n\n\t\t\t\t\tgitname = tag.split('/')[-1][:-4]\n\t\t\t\t\tprojectdir = os.path.join(GITCACHE, gitname)\n\n\t\t\t\t\trebuild = True\n\t\t\t\t\tif gitname not in os.listdir(GITCACHE):\n\t\t\t\t\t\tcmd = ['git', 'clone', tag]\n\t\t\t\t\t\tsubprocess.check_call(cmd, cwd=GITCACHE)\n\t\t\t\t\telif '--git-sync' in sys.argv:\n\t\t\t\t\t\tcmd = ['git', 'pull']\n\t\t\t\t\t\tsubprocess.check_call(cmd, cwd=projectdir)\n\t\t\t\t\telse:\n\t\t\t\t\t\trebuild = False\n\n\t\t\t\t\tif rebuild or '--force-rebuild-deps' in sys.argv:\n\t\t\t\t\t\tprint 'rebuilding git repo: ' + tag\n\t\t\t\t\t\t## TODO restrict the bash syntax allowed here,\n\t\t\t\t\t\t## or build it in a sandbox or docker container.\n\t\t\t\t\t\tfor line in mod['code'].splitlines():\n\t\t\t\t\t\t\tif not line.strip(): continue\n\t\t\t\t\t\t\tif not is_restricted_bash(line):\n\t\t\t\t\t\t\t\traise SyntaxError('bash build script syntax is restricted:\\n'+line)\n\t\t\t\t\t\t\telse:\n\t\t\t\t\t\t\t\tprint '>>'+line\n\t\t\t\t\t\t\tsubprocess.check_call( line.split(), cwd=projectdir )\n\n\t\t\t\telse:\n\t\t\t\t\toutput['datafiles'][tag] = mod['code']\n\n\n\tif modules['gyp']:\n\t\tfor mod in modules['gyp']:\n\t\t\tif 'tag' in mod and mod['tag']:\n\t\t\t\tif not mod['tag'] != 'binding.gyp':\n\t\t\t\t\traise RuntimeError('nw-gyp requires the gyp file is named `binding.gyp`')\n\n\t\t\toutput['datafiles']['binding.gyp'] = mod['code']\n\n\t\t\tgypcfg = json.loads( mod['code'].replace(\"'\", '\"') )\n\t\t\t#if len(gypcfg['targets']) > 1:\n\t\t\t#\tcontinue\n\t\t\tfor gtarget in gypcfg['targets']:\n\t\t\t\tfor gsrc in gtarget['sources']:\n\t\t\t\t\tgyp_builds[ gsrc ] = {\n\t\t\t\t\t\t'gyp':mod['code'],\n\t\t\t\t\t\t'src': None\n\t\t\t\t\t}\n\n\n\tif modules['javascript']:\n\t\tfor mod in modules['javascript']:\n\t\t\tif 'tag' in mod and mod['tag']:\n\t\t\t\ttagged[ mod['tag'] ] = mod['code']\n\t\t\t\tif '.' in mod['tag']:\n\t\t\t\t\toutput['datafiles'][mod['tag']] = mod['code']\n\n\tif modules['json']:\n\t\tfor mod in modules['json']:\n\t\t\tcached_json[ mod['name'] ] = mod['code']\n\t\t\toutput['json'].append(mod)\n\n\tif modules['c#']:\n\t\tfor mod in modules['c#']:\n\t\t\toutput['c#'].append(mod)\n\n\tif modules['elm']:\n\t\tfor mod in modules['elm']:\n\t\t\ttmpelm = tempfile.gettempdir() + '/MyApp.elm'\n\t\t\ttmpjs = tempfile.gettempdir() + '/elm-output.js'\n\t\t\topen(tmpelm, 'wb').write(mod['code'])\n\t\t\tsubprocess.check_call(['elm-make', tmpelm, '--output', tmpjs])\n\t\t\telmdata = open(tmpjs,'rb').read()\n\t\t\toutput['datafiles'][mod['tag']] = elmdata\n\t\t\ttagged[ mod['tag'] ] = elmdata\n\n\n\tif modules['coffee']:\n\t\tfor mod in modules['coffee']:\n\t\t\ttmpcoff = tempfile.gettempdir() + '/temp.coffee'\n\t\t\ttmpjs = tempfile.gettempdir() + '/coffee-output.js'\n\t\t\topen(tmpcoff, 'wb').write(mod['code'])\n\t\t\tsubprocess.check_call(['coffee', '--compile', '--bare', '--output', tmpjs, tmpcoff])\n\t\t\tcoffdata = open(tmpjs+'/temp.js','rb').read()\n\t\t\toutput['datafiles'][mod['tag']] = coffdata\n\t\t\ttagged[ mod['tag'] ] = coffdata\n\n\tif modules['rapydscript']:\n\t\tfor mod in modules['rapydscript']:\n\t\t\ttmprapyd = tempfile.gettempdir() + '/temp.rapyd'\n\t\t\ttmpjs = tempfile.gettempdir() + '/rapyd-output.js'\n\t\t\topen(tmprapyd, 'wb').write(mod['code'].encode('utf-8'))\n\t\t\tsubprocess.check_call(['rapydscript', tmprapyd, '--bare', '--output', tmpjs])\n\t\t\trapydata = open(tmpjs,'rb').read()\n\t\t\toutput['datafiles'][mod['tag']] = rapydata\n\t\t\ttagged[ mod['tag'] ] = rapydata\n\n\tif modules['nim']:\n\t\tlibdl = True\n\t\t## if compile_nim_lib is False then use old hack to compile nim source by extracting it and forcing into a single file.\n\t\tcompile_nim_lib = True\n\t\tnimbin = os.path.expanduser('~/Nim/bin/nim')\n\t\tniminclude = os.path.expanduser('~/Nim/lib')\n\n\t\tif os.path.isfile(nimbin):\n\t\t\tmods_sorted_by_index = sorted(modules['nim'], key=lambda mod: mod.get('index'))\n\t\t\tfor mod in mods_sorted_by_index:\n\n\t\t\t\tif mod['tag']: ## save standalone nim program, can be run with `rusthon.py my.md --run=myapp.nim`\n\t\t\t\t\toutput['nim'].append(mod)\n\n\t\t\t\telse: ## use nim to translate to C and build later as staticlib\n\t\t\t\t\ttmpfile = tempfile.gettempdir() + '/rusthon_build.nim'\n\t\t\t\t\tnimsrc = mod['code'].replace('\\t', ' ') ## nim will not accept tabs, replace with two spaces.\n\t\t\t\t\tgen_nim_wrappers( nimsrc, nim_wrappers )\n\t\t\t\t\topen(tmpfile, 'wb').write( nimsrc )\n\t\t\t\t\tif compile_nim_lib:\n\t\t\t\t\t\t## lets nim compile the library\n\t\t\t\t\t\t#cmd = [nimbin, 'compile', '--app:staticLib', '--noMain', '--header'] ## staticlib has problems linking with dlopen,etc.\n\t\t\t\t\t\tcmd = [nimbin, 'compile', '--app:lib', '--noMain', '--header']\n\t\t\t\t\telse:\n\t\t\t\t\t\tcmd = [\n\t\t\t\t\t\t\tnimbin,\n\t\t\t\t\t\t\t'compile',\n\t\t\t\t\t\t\t'--header',\n\t\t\t\t\t\t\t'--noMain',\n\t\t\t\t\t\t\t'--noLinking',\n\t\t\t\t\t\t\t'--compileOnly',\n\t\t\t\t\t\t\t'--genScript', ## broken?\n\t\t\t\t\t\t\t'--app:staticLib', ## Araq says staticlib and noMain will not work together.\n\t\t\t\t\t\t\t'--deadCodeElim:on',\n\t\t\t\t\t\t]\n\t\t\t\t\tif 'import threadpool' in nimsrc:\n\t\t\t\t\t\tcmd.append('--threads:on')\n\t\t\t\t\tcmd.append('rusthon_build.nim')\n\n\t\t\t\t\tprint('-------- compile nim program -----------')\n\t\t\t\t\tprint(' '.join(cmd))\n\t\t\t\t\tsubprocess.check_call(cmd, cwd=tempfile.gettempdir())\n\n\t\t\t\t\tif compile_nim_lib:\n\t\t\t\t\t\t## staticlib broken in nim? missing dlopen\n\t\t\t\t\t\tlibname = 'rusthon_build'\n\t\t\t\t\t\tlink.append(libname)\n\t\t\t\t\t\t#output['c'].append({'source':mod['code'], 'staticlib':libname+'.a'})\n\t\t\t\t\t\toutput['c'].append(\n\t\t\t\t\t\t\t{'source':mod['code'], 'dynamiclib':libname+'.so', 'name':'lib%s.so'%libname}\n\n\t\t\t\t\t\t)\n\t\t\t\t\telse:\n\t\t\t\t\t\t## get source from nim cache ##\n\t\t\t\t\t\tnimcache = os.path.join(tempfile.gettempdir(), 'nimcache')\n\t\t\t\t\t\tnim_stdlib = hack_nim_stdlib(\n\t\t\t\t\t\t\topen(os.path.join(nimcache,'stdlib_system.c'), 'rb').read()\n\t\t\t\t\t\t)\n\t\t\t\t\t\t#nim_header = open(os.path.join(nimcache,'rusthon_build.h'), 'rb').read()\n\t\t\t\t\t\tnim_code = hack_nim_code(\n\t\t\t\t\t\t\topen(os.path.join(nimcache,'rusthon_build.c'), 'rb').read()\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\t## gets compiled below\n\t\t\t\t\t\tcfg = {\n\t\t\t\t\t\t\t'dynamic' : True,\n\t\t\t\t\t\t\t'link-dirs' :[nimcache, niminclude],\n\t\t\t\t\t\t\t#'build-dirs':[nimcache], ## not working\n\t\t\t\t\t\t\t'index' : mod['index'],\n\t\t\t\t\t\t\t'code' : '\\n'.join([nim_stdlib, nim_code])\n\t\t\t\t\t\t\t#'code' : header\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmodules['c'].append( cfg )\n\t\telse:\n\t\t\tprint('WARNING: can not find nim compiler')\n\n\tif modules['java']:\n\t\tmods_sorted_by_index = sorted(modules['java'], key=lambda mod: mod.get('index'))\n\t\tjavafiles = []\n\t\ttmpdir = tempfile.gettempdir()\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tif mod['tag']=='java2rusthon':\n\t\t\t\trcode = java_to_rusthon( mod['code'] )\n\t\t\t\tjava2rusthon.append( rcode )\n\t\t\telif 'name' in mod:\n\t\t\t\tjpath = os.path.join(tmpdir, mod['name'])\n\t\t\t\tif '/' in mod['name']:\n\t\t\t\t\tjdir,jname = os.path.split(jpath)\n\t\t\t\t\tif not os.path.isdir(jdir):\n\t\t\t\t\t\tos.makedirs(jdir)\n\t\t\t\topen(jpath, 'wb').write(mod['code'])\n\t\t\t\tjavafiles.append( jpath )\n\t\t\telse:\n\t\t\t\traise SyntaxError('java code must have a tag header: `java2rusthon` or a file path')\n\n\t\tif javafiles:\n\t\t\toutput['java'].append( compile_java( javafiles ) )\n\n\n\tif modules['xml']:\n\t\tmods_sorted_by_index = sorted(modules['xml'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tif mod['tag']=='gwis':\n\t\t\t\tgiws.append(mod['code']) ## hand written bindings should get saved in output tar.\n\t\t\t\tbindings = compile_giws_bindings(mod['code'])\n\t\t\t\tmodules['c++'].append( {'code':bindings, 'index': mod['index']}) ## gets compiled below\n\t\t\telse:\n\t\t\t\toutput['xml'].append(mod)\n\n\tjs_merge = []\n\tcpp_merge = []\n\tcpp_links = []\n\tcpp_idirs = []\n\tcpp_defines = []\n\tcompile_mode = 'binary'\n\texename = 'rusthon-test-bin'\n\ttagged_trans_src = {}\n\n\n\tif modules['rusthon']:\n\t\tmods_sorted_by_index = sorted(modules['rusthon'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tscript = mod['code']\n\t\t\tindex = mod.get('index')\n\t\t\theader = script.splitlines()[0]\n\t\t\tbackend = 'c++' ## default to c++ backend\n\t\t\tif header.startswith('#backend:'):\n\t\t\t\tbackend = header.split(':')[-1].strip()\n\t\t\t\tif ' ' in backend:\n\t\t\t\t\tbackend, compile_mode = backend.split(' ')\n\t\t\t\tif '\\t' in backend:\n\t\t\t\t\tbackend, compile_mode = backend.split('\\t')\n\n\t\t\t\tif backend not in 'c++ rust javascript go verilog dart lua'.split():\n\t\t\t\t\traise SyntaxError('invalid backend: %s' %backend)\n\n\t\t\t\tif compile_mode and compile_mode not in 'binary staticlib dynamiclib'.split():\n\t\t\t\t\traise SyntaxError('invalid backend option <%s> (valid types: binary, staticlib, dynamiclib)' %backend)\n\n\t\t\tif backend == 'verilog':\n\t\t\t\tvcode = translate_to_verilog( script )\n\t\t\t\tmodules['verilog'].append( {'code':vcode, 'index': index}) ## gets compiled below\n\n\t\t\telif backend == 'c++':\n\t\t\t\tif mod['tag'] and mod['tag'] and '.' not in mod['tag']:\n\t\t\t\t\texename = mod['tag']\n\n\t\t\t\t## user named output for external build tools that need .h,.hpp,.cpp, files output to hardcoded paths.\n\t\t\t\tif mod['tag'] and (mod['tag'].endswith('.h') or mod['tag'].endswith('.hpp') or mod['tag'].endswith('.cpp') or mod['tag'].endswith('.cc')):\n\t\t\t\t\tpyjs = python_to_pythonjs(script, cpp=True, module_path=module_path)\n\t\t\t\t\tuse_try = True\n\t\t\t\t\tif '--no-except' in sys.argv:\n\t\t\t\t\t\tuse_try = False\n\t\t\t\t\telif mod['tag'] in gyp_builds.keys(): ## nw-gyp builds without c++ exceptions\n\t\t\t\t\t\tuse_try = False\n\n\t\t\t\t\tpak = translate_to_cpp(\n\t\t\t\t\t\tpyjs, \n\t\t\t\t\t\tcached_json_files=cached_json, \n\t\t\t\t\t\tinsert_runtime=mod['tag'] in gyp_builds.keys(),\n\t\t\t\t\t\tuse_try = use_try\n\t\t\t\t\t)\n\t\t\t\t\tif '--debug-c++' in sys.argv:\n\t\t\t\t\t\traise RuntimeError(pak)\n\t\t\t\t\t## pak contains: c_header and cpp_header\n\t\t\t\t\toutput['datafiles'][ mod['tag'] ] = pak['main'] ## save to output c++ to tar\n\n\t\t\t\t\tif mod['tag'] in gyp_builds.keys():\n\t\t\t\t\t\tgyp_builds[ mod['tag'] ]['src'] = pak['main']\n\n\t\t\t\t\tif 'user-headers' in pak:\n\t\t\t\t\t\tfor classtag in pak['user-headers'].keys():\n\t\t\t\t\t\t\tclassheader = pak['user-headers'][ classtag ]\n\t\t\t\t\t\t\theaderfile = classheader['file']\n\t\t\t\t\t\t\tif headerfile in output['datafiles']:\n\t\t\t\t\t\t\t\toutput['datafiles'][ headerfile ] += '\\n' + '\\n'.join(classheader['source'])\n\t\t\t\t\t\t\telse:\n\t\t\t\t\t\t\t\toutput['datafiles'][ headerfile ] = '\\n' + '\\n'.join(classheader['source'])\n\n\t\t\t\telse:\n\t\t\t\t\tcpp_merge.append(script)\n\n\t\t\t\t\tif 'links' in mod:\n\t\t\t\t\t\tcpp_links.extend(mod['links'])\n\t\t\t\t\tif 'include-dirs' in mod:\n\t\t\t\t\t\tcpp_idirs.extend(mod['include-dirs'])\n\t\t\t\t\tif 'defines' in mod:\n\t\t\t\t\t\tcpp_defines.extend(mod['defines'])\n\n\t\t\telif backend == 'rust':\n\t\t\t\tpyjs = python_to_pythonjs(script, rust=True, module_path=module_path)\n\t\t\t\trustcode = translate_to_rust( pyjs )\n\t\t\t\tmodules['rust'].append( {'code':rustcode, 'index': index}) ## gets compiled below\n\n\t\t\telif backend == 'go':\n\t\t\t\tpyjs = python_to_pythonjs(script, go=True, module_path=module_path)\n\t\t\t\tgocode = translate_to_go( pyjs )\n\t\t\t\t#modules['go'].append( {'code':gocode}) ## gets compiled below\n\t\t\t\tgo_main['source'].append( gocode )\n\n\t\t\telif backend == 'javascript':\n\t\t\t\tif mod['tag'] and mod['tag'].endswith('.js'): ## saves to external js file\n\t\t\t\t\tjs = compile_js( mod['code'], module_path, main_name=mod['tag'] )\n\t\t\t\t\tmod['build'] = {'script':js[mod['tag']]}\n\t\t\t\t\ttagged[ mod['tag'] ] = js[mod['tag']]\n\t\t\t\t\ttagged_trans_src[ mod['tag'] ] = mod['code'] ## so user can embed original source using <!tagname>\n\t\t\t\t\tfor name in js:\n\t\t\t\t\t\toutput['javascript'].append( {'name':name, 'script':js[name], 'index': index} )\n\t\t\t\telse:\n\t\t\t\t\tjs_merge.append(mod)\n\n\t\t\telif backend == 'lua':\n\t\t\t\tpyjs = python_to_pythonjs(script, lua=True, module_path=module_path)\n\t\t\t\tluacode = translate_to_lua( pyjs )\n\t\t\t\tname = 'main.lua'\n\t\t\t\tif mod['tag']: name = mod['tag']\n\t\t\t\tif not name.endswith('.lua'): name += '.lua'\n\t\t\t\toutput['lua'].append( {'name':name, 'script':luacode, 'index': index} )\n\n\t\t\telif backend == 'dart':\n\t\t\t\tpyjs = python_to_pythonjs(script, dart=True, module_path=module_path)\n\t\t\t\tdartcode = translate_to_dart( pyjs )\n\t\t\t\tname = 'main.dart'\n\t\t\t\tif mod['tag']: name = mod['tag']\n\t\t\t\tif not name.endswith('.dart'): name += '.dart'\n\t\t\t\toutput['dart'].append( {'name':name, 'script':dartcode, 'index': index} )\n\n\tif js_merge:\n\t\ttaggroups = {}\n\t\tfor mod in js_merge:\n\t\t\ttagname = mod['tag']\n\t\t\tif tagname not in taggroups:\n\t\t\t\ttaggroups[tagname] = []\n\n\t\t\tsrc = taggroups[tagname]\n\t\t\tsrc.append( mod['code'] )\n\t\tfor tagname in taggroups.keys():\n\t\t\tgroupsrc = '\\n'.join( taggroups[tagname] )\n\t\t\tjs = compile_js( groupsrc, module_path, main_name=tagname )\n\t\t\ttagged[ tagname ] = js[ tagname ]\n\t\t\ttagged_trans_src[ tagname ] = groupsrc\n\n\t\t\tfor name in js:\n\t\t\t\toutput['javascript'].append( {'name':name, 'script':js[name], 'index': index} )\n\n\n\tcpyembed = []\n\tnuitka = []\n\tnuitka_include_path = None ## TODO option for this\n\tnuitka_module_name = 'unnamed_nuitka_module'\n\tif modules['python']:\n\t\tmods_sorted_by_index = sorted(modules['python'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tif mod['tag']:\n\t\t\t\tname = mod['tag']\n\t\t\t\tif name == 'nuitka' or name.startswith('nuitka:'):\n\t\t\t\t\tif ':' in name:\n\t\t\t\t\t\tnuitka_module_name = name.split(':')[-1]\n\t\t\t\t\tif not len(nuitka):\n\t\t\t\t\t\t## __file__ is undefined when CPython is embedded\n\t\t\t\t\t\t#cpyembed.append('sys.path.append(os.path.dirname(__file__))')\n\t\t\t\t\t\t#cpyembed.append('print sys.argv') ## also undefined\n\t\t\t\t\t\tcpyembed.append('import sys')\n\t\t\t\t\t\tcpyembed.append('sys.path.append(\"./\")')\n\t\t\t\t\t\tcpyembed.append('from %s import *'%nuitka_module_name)\n\n\t\t\t\t\tnuitka.append(mod['code'])\n\n\t\t\t\telif name == 'embed' or name == 'embed:cpython':\n\t\t\t\t\tcpyembed.append(mod['code'])\n\t\t\t\telse:\n\t\t\t\t\tif not name.endswith('.py'):\n\t\t\t\t\t\tname += '.py'\n\t\t\t\t\toutput['python'].append( {'name':name, 'script':mod['code']} )\n\t\t\telse:\n\t\t\t\tif len(output['python'])==0:\n\t\t\t\t\tpython_main['script'].append( mod['code'] )\n\t\t\t\telse:\n\t\t\t\t\toutput['python'][-1]['script'] += '\\n' + mod['code']\n\n\n\tif cpp_merge:\n\t\tmerge = []\n\t\tnuitka_funcs = []\n\t\tif java2rusthon:\n\t\t\tmerge.extend(java2rusthon)\n\t\t\tjava2rusthon = None\n\t\tif nim_wrappers:\n\t\t\t## inserts generated rusthon nim wrappers into script before translation ##\n\t\t\tnim_wrappers.insert(0,'# nim wrappers generated by rusthon #')\n\t\t\tnim_wrappers.insert(1, 'with extern(abi=\"C\"):')\n\t\t\tmerge.extend(nim_wrappers)\n\t\tif nuitka:\n\t\t\t#npak = nuitka_compile_integrated('\\n'.join(nuitka), nuitka_funcs)\n\t\t\t#for h in npak['files']:\n\t\t\t#\tmodules['c++'].append(\n\t\t\t#\t\t{'code':h['data'], 'tag':h['name'], 'index':0}\n\t\t\t#\t)\n\t\t\tnsrc = '\\n'.join(nuitka)\n\t\t\toutput['c++'].append(\n\t\t\t\t{\n\t\t\t\t\t'staticlib' : nuitka_compile( nsrc, nuitka_module_name ),\n\t\t\t\t\t'source-name' : 'my_nuitka_module.py',\n\t\t\t\t\t'name' : 'my_nuitka_module.so',\n\t\t\t\t\t'source' : nsrc,\n\t\t\t\t}\n\t\t\t)\n\n\t\tmerge.extend(cpp_merge)\n\t\tscript = '\\n'.join(merge)\n\t\tpyjs = python_to_pythonjs(script, cpp=True, module_path=module_path)\n\t\tpak = translate_to_cpp( pyjs, cached_json_files=cached_json ) ## pak contains: c_header and cpp_header\n\t\tn = len(modules['c++']) + len(giws)\n\t\tcppcode = pak['main']\n\t\t#if nuitka:\n\t\t#\tcppcode = npak['main'] + '\\n' + cppcode\n\t\tif cpyembed:\n\t\t\tinlinepy = ('\\n'.join(cpyembed)).replace('\\n', '\\\\n').replace('\"', '\\\\\"')\n\t\t\tstaticstr = 'const char* __python_main_script__ = \"%s\";\\n' %inlinepy\n\t\t\tcppcode = staticstr + cppcode\n\t\tmodules['c++'].append(\n\t\t\t{'code':cppcode, 'index':n+1, 'links':cpp_links, 'include-dirs':cpp_idirs, 'defines':cpp_defines}\n\t\t) ## gets compiled below\n\n\n\n\t## HTML ##\n\tif modules['html']:\n\t\tmods_sorted_by_index = sorted(modules['html'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\thtml = []\n\t\t\tfor line in mod['code'].splitlines():\n\t\t\t\t## `~/some/path/myscript.js` special syntax to copy javascript directly into the output html, good for testing locally.\n\t\t\t\tif line.strip().startswith('<script ') and line.strip().endswith('</script>') and 'src=\"~/' in line:\n\t\t\t\t\turl = line.split('src=\"')[-1].split('\"')[0]\n\t\t\t\t\turl = os.path.expanduser( url )\n\n\t\t\t\t\tif os.path.isfile(url):\n\t\t\t\t\t\thtml.append('<script type=\"text/javascript\">')\n\t\t\t\t\t\thtml.append( open(url, 'rb').read().decode('utf-8') )\n\t\t\t\t\t\thtml.append('</script>')\n\t\t\t\t\telif 'git=\"' in line:\n\t\t\t\t\t\tgiturl = line.split('git=\"')[-1].split('\"')[0]\n\t\t\t\t\t\tprint 'downloading library-> ' + giturl\n\t\t\t\t\t\tcmd = ['git', 'clone', giturl]\n\t\t\t\t\t\tsubprocess.check_call(cmd, cwd=os.environ['HOME'])\n\t\t\t\t\t\tassert os.path.isfile(url)\n\t\t\t\t\t\thtml.append('<script type=\"text/javascript\">')\n\t\t\t\t\t\thtml.append( open(url, 'rb').read().decode('utf-8') )\n\t\t\t\t\t\thtml.append('</script>')\n\t\t\t\t\telif 'source=\"' in line:\n\t\t\t\t\t\tsrcurl = line.split('source=\"')[-1].split('\"')[0]\n\t\t\t\t\t\tprint 'downloading javascript-> ' + srcurl\n\t\t\t\t\t\timport urllib\n\t\t\t\t\t\tsrcdata = urllib.urlopen(srcurl).read()\n\t\t\t\t\t\tsrcpath = os.path.split(url)[0]\n\t\t\t\t\t\tif not os.path.isdir(srcpath):\n\t\t\t\t\t\t\tos.makedirs(srcpath)\n\t\t\t\t\t\topen(url, 'wb').write(srcdata)\n\t\t\t\t\t\tassert os.path.isfile(url)\n\t\t\t\t\t\thtml.append('<script type=\"text/javascript\">')\n\t\t\t\t\t\thtml.append( open(url, 'rb').read().decode('utf-8') )\n\t\t\t\t\t\thtml.append('</script>')\n\n\t\t\t\t\telse:\n\t\t\t\t\t\tprint('ERROR: could not find file to inline: %s' %url)\n\t\t\t\t\t\thtml.append( line )\n\t\t\t\telif line.strip().startswith('<link ') and ('href=\"~/' in line or \"href='~/\" in line):\n\t\t\t\t\tzipurl = None\n\t\t\t\t\tif 'zip=\"' in line:\n\t\t\t\t\t\tzipurl = line.split('zip=\"')[-1].split('\"')[0]\n\n\t\t\t\t\tif 'href=\"' in line:\n\t\t\t\t\t\turl = line.split('href=\"')[-1].split('\"')[0]\n\t\t\t\t\telse:\n\t\t\t\t\t\turl = line.split(\"href='\")[-1].split(\"'\")[0]\n\n\t\t\t\t\turl = os.path.expanduser( url )\n\t\t\t\t\tif os.path.isfile(url):\n\t\t\t\t\t\thtml.append('<style>')\n\t\t\t\t\t\thtml.append( open(url, 'rb').read() )\n\t\t\t\t\t\thtml.append('</style>')\n\t\t\t\t\telif zipurl:\n\t\t\t\t\t\timport urllib\n\t\t\t\t\t\tprint 'downloading css library->' + zipurl\n\t\t\t\t\t\tzipdata = urllib.urlopen(zipurl).read()\n\t\t\t\t\t\topen('/tmp/csslib.zip', 'wb').write( zipdata )\n\t\t\t\t\t\tsubprocess.check_call(['unzip', '/tmp/csslib.zip'], cwd=os.environ['HOME'])\n\t\t\t\t\t\thtml.append('<style>')\n\t\t\t\t\t\thtml.append( open(url, 'rb').read() )\n\t\t\t\t\t\thtml.append('</style>')\n\n\t\t\t\t\telse:\n\t\t\t\t\t\tprint('ERROR: could not find css file to inline: %s' %url)\n\t\t\t\t\t\thtml.append( line )\n\n\t\t\t\telse:\n\t\t\t\t\thtml.append( line )\n\n\t\t\thtml = unicode('\\n'.join(html))\n\n\t\t\tfor tagname in tagged:\n\t\t\t\ttag = u'<@%s>' %tagname\n\t\t\t\tjs = tagged[tagname]\n\t\t\t\tif tag in html:\n\t\t\t\t\t## TODO fix this ugly mess\n\t\t\t\t\ttry:\n\t\t\t\t\t\t## javascript with unicode\n\t\t\t\t\t\txxx = u'<script type=\"text/javascript\" id=\"%s_transpiled\">\\n%s</script>' %(tagname, js)\n\t\t\t\t\texcept UnicodeDecodeError:\n\t\t\t\t\t\t## rusthon translated to js\n\t\t\t\t\t\txxx = u'<script type=\"text/javascript\" id=\"%s_transpiled\">\\n%s</script>' %(tagname, js.decode('utf-8'))\n\t\t\t\t\thtml = html.replace(tag, xxx)\n\n\t\t\t\tif tagname in tagged_trans_src.keys():\n\t\t\t\t\tstag = u'<!%s>' %tagname\n\t\t\t\t\tpy = tagged_trans_src[tagname]\n\t\t\t\t\tif stag in html:\n\t\t\t\t\t\t## TODO fix this ugly mess\n\t\t\t\t\t\ttry:\n\t\t\t\t\t\t\txxx = u'<script type=\"text/rusthon\" id=\"%s\">\\n%s</script>' %(tagname, py)\n\t\t\t\t\t\texcept UnicodeDecodeError:\n\t\t\t\t\t\t\txxx = u'<script type=\"text/rusthon\" id=\"%s\">\\n%s</script>' %(tagname, py.decode('utf-8'))\n\t\t\t\t\t\thtml = html.replace(stag, xxx)\n\n\n\t\t\tmod['code'] = html\n\t\t\toutput['html'].append( mod )\n\t\t\t## inlines js app into openshift default style python server ##\n\t\t\tif '--openshift-python' in sys.argv:\n\t\t\t\timport base64\n\t\t\t\tbcoded = base64.b64encode(mod['code'].encode('utf-8'))\n\t\t\t\twsgi = [ OPENSHIFT_PY[0]%bcoded, OPENSHIFT_PY[1] ]\n\t\t\t\toutput['datafiles']['wsgi.py'] = '\\n'.join(wsgi).encode('utf-8')\n\n\tif modules['verilog']:\n\t\tsource = []\n\t\tmainmod = None\n\t\tmods_sorted_by_index = sorted(modules['verilog'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tsource.append( mod['code'] )\n\t\t\tif 'name' in mod and mod['name']=='main':\n\t\t\t\tmainmod = mod\n\t\t\telif mainmod is None:\n\t\t\t\tmainmod = mod\n\n\t\tsource = '\\n'.join(source)\n\n\t\tmod = {}\n\t\toutput['verilog'].append(mod)\n\n\t\tif os.path.isfile('/usr/bin/iverilog') or os.path.isfile('/usr/local/bin/iverilog'):\n\t\t\tmod['source'] = source\n\t\t\tmod['binary'] = tempfile.gettempdir() + '/rusthon-sv-build.vvp'\n\t\t\tmod['name'] = 'main.vvp'\n\t\t\toutput['executeables'].append( mod['binary'] )\n\t\t\ttmpfile = tempfile.gettempdir() + '/rusthon-verilog-build.sv'\n\t\t\topen(tmpfile, 'wb').write( source )\n\t\t\t## note: iverilog defaults to verilog mode, not systemverilog, `-g2005-sv` is required. '-g2012' also works.\n\t\t\tcmd = [\n\t\t\t\t'iverilog',\n\t\t\t\t'-g2005-sv',\n\t\t\t\t'-o',\n\t\t\t\t'rusthon-sv-build.vvp',\n\t\t\t\ttmpfile\n\t\t\t]\n\t\t\tp = subprocess.Popen(cmd, cwd=tempfile.gettempdir(), stdout=subprocess.PIPE, stderr=subprocess.PIPE )\n\t\t\tp.wait()\n\t\t\tif p.returncode != 0:\n\t\t\t\tsrclines = source.splitlines()\n\t\t\t\terr = p.stderr.read() ## ends with \"I give up.\"\n\t\t\t\terrors = []\n\t\t\t\tfor line in err.splitlines():\n\t\t\t\t\tif 'syntax error' in line:\n\t\t\t\t\t\terrors.append('- - - - - - - - - - - -')\n\t\t\t\t\t\tlineno = int( line.split(':')[-2] )\n\t\t\t\t\t\te = [\n\t\t\t\t\t\t\t'Syntax Error - line: %s' %lineno,\n\t\t\t\t\t\t]\n\t\t\t\t\t\tif lineno-2 < len(srclines):\n\t\t\t\t\t\t\te.append( srclines[lineno-2] )\n\t\t\t\t\t\tif lineno-1 < len(srclines):\n\t\t\t\t\t\t\te.append( srclines[lineno-1] )\n\t\t\t\t\t\tif lineno < len(srclines):\n\t\t\t\t\t\t\te.append( srclines[lineno] )\n\n\t\t\t\t\t\terrors.extend( e )\n\t\t\t\t\telse:\n\t\t\t\t\t\terrors.append(line)\n\n\t\t\t\tmsg = [' '.join(cmd)]\n\t\t\t\tfor i,line in enumerate(source.splitlines()):\n\t\t\t\t\tmsg.append('%s:\t%s' %(i+1, line))\n\t\t\t\tmsg.extend(errors)\n\t\t\t\traise RuntimeError('\\n'.join(msg))\n\n\n\t\telse:\n\t\t\tprint('WARNING: could not find iverilog')\n\t\t\tmod['code'] = source\n\n\tif modules['go']:\n\t\tfor mod in modules['go']:\n\t\t\tif 'name' in mod:\n\t\t\t\tname = mod['name']\n\t\t\t\tif name=='main':\n\t\t\t\t\tgo_main['source'].append( mod['code'] )\n\t\t\t\telse:\n\t\t\t\t\toutput['go'].append( mod )\n\t\t\telse:\n\t\t\t\tgo_main['source'].append( mod['code'] )\n\n\tif go_main['source']:\n\t\tgo_main['source'] = '\\n'.join(go_main['source'])\n\t\toutput['go'].insert( 0, go_main )\n\n\tif output['go']:\n\t\tsource = [ mod['source'] for mod in output['go'] ]\n\t\ttmpfile = tempfile.gettempdir() + '/rusthon-go-build.go'\n\t\topen(tmpfile, 'wb').write( '\\n'.join(source) )\n\t\tif GO_EXE:\n\t\t\tcmd = [GO_EXE, 'build', tmpfile]\n\t\t\tsubprocess.check_call([GO_EXE, 'build', tmpfile], cwd=tempfile.gettempdir() )\n\t\t\tmod['binary'] = tempfile.gettempdir() + '/rusthon-go-build'\n\t\t\toutput['executeables'].append(tempfile.gettempdir() + '/rusthon-go-build')\n\n\n\tif modules['rust']:\n\t\tsource = []\n\t\tmainmod = None\n\t\tmods_sorted_by_index = sorted(modules['rust'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tsource.append( mod['code'] )\n\t\t\tif 'name' in mod and mod['name']=='main':\n\t\t\t\tmainmod = mod\n\t\t\telif mainmod is None:\n\t\t\t\tmainmod = mod\n\n\t\ttmpfile = tempfile.gettempdir() + '/rusthon-build.rs'\n\t\tdata = '\\n'.join(source)\n\t\topen(tmpfile, 'wb').write( data )\n\n\t\tpak = None\n\t\tif modules['c++']:\n\t\t\tlibname = 'rusthon-lib%s' %len(output['rust'])\n\t\t\tlink.append(libname)\n\t\t\tsubprocess.check_call(['rustc', '--crate-name', 'rusthon', '--crate-type', 'staticlib' ,'-o', tempfile.gettempdir() + '/'+libname, tmpfile] )\n\t\t\tpak = {'source':data, 'staticlib':libname, 'name':'lib'+libname+'.a'}\n\n\t\telse:\n\t\t\tsubprocess.check_call(['rustc', '--crate-name', 'rusthon', '-o', tempfile.gettempdir() + '/rusthon-bin', tmpfile] )\n\t\t\tpak = {'source':data, 'binary':tempfile.gettempdir() + '/rusthon-bin', 'name':'rusthon-bin'}\n\t\t\toutput['executeables'].append(tempfile.gettempdir() + '/rusthon-bin')\n\n\t\tassert pak\n\t\tmainmod['build'] = pak\n\t\toutput['rust'].append( pak )\n\n\n\tif modules['c']:\n\t\tdynamiclib = False\n\t\tsource = []\n\t\tcinclude = []\n\t\tcbuild = []\n\t\tmods_sorted_by_index = sorted(modules['c'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tif 'dynamic' in mod and mod['dynamic']:\n\t\t\t\tdynamiclib = True\n\t\t\tif 'link-dirs' in mod:\n\t\t\t\tcinclude.extend(mod['link-dirs'])\n\t\t\tif 'build-dirs' in mod:\n\t\t\t\tfor bdir in mod['build-dirs']:\n\t\t\t\t\tfor fname in os.listdir(bdir):\n\t\t\t\t\t\tif fname.endswith('.c'):\n\t\t\t\t\t\t\tcbuild.append(os.path.join(bdir,fname))\n\n\t\t\tif 'code' in mod and mod['code']:\n\t\t\t\tsource.append( mod['code'] )\n\t\t\telse:\n\t\t\t\t## module must contain a build config\n\t\t\t\traise RuntimeError('missing code')\n\n\t\tif source:\n\t\t\tdata = '\\n'.join(source)\n\t\t\tcpak = {'source':data}\n\t\t\toutput['c'].append(cpak)\n\n\t\t\tlibname = 'default-clib%s' %len(output['c']) ## TODO user named\n\t\t\tlink.append(libname)\n\t\t\tdynamic_path = tempfile.gettempdir() + '/lib'+libname+'.so'\n\t\t\tstatic_path = tempfile.gettempdir() + '/lib'+libname+'.a'\n\t\t\tobject_path = tempfile.gettempdir() + '/'+libname+'.o'\n\n\n\t\t\ttmpfile = tempfile.gettempdir() + '/rusthon-build.c'\n\t\t\topen(tmpfile, 'wb').write( data )\n\n\t\t\tcmd = ['gcc']\n\t\t\tfor idir in cinclude:\n\t\t\t\tcmd.append('-I'+idir)\n\t\t\tcmd.extend(['-c', tmpfile])\n\n\n\t\t\tif dynamiclib:\n\t\t\t\tcmd.extend(\n\t\t\t\t\t[\n\t\t\t\t\t\t'-fPIC',\n\t\t\t\t\t\t'-O3',\n\t\t\t\t\t\t'-fomit-frame-pointer',\n\t\t\t\t\t\t'-Wall', '-Wno-unused',\n\t\t\t\t\t\t'-o', object_path\n\t\t\t\t\t]\n\t\t\t\t)\n\t\t\t\tsubprocess.check_call(cmd)\n\n\t\t\t\tcmd = [\n\t\t\t\t\t'gcc',\n\t\t\t\t\t'-shared',\n\t\t\t\t\t'-Wl,-soname,lib%s.so' %libname,\n\t\t\t\t\t#'-Wl,-rpath,/tmp',\n\t\t\t\t\t'-Wl,--export-dynamic',\n\t\t\t\t\t'-pthread', '-o', dynamic_path,\n\t\t\t\t\tobject_path\n\t\t\t\t]\n\t\t\t\tsubprocess.check_call(cmd)\n\t\t\t\tcpak['dynamiclib'] = dynamic_path\n\t\t\t\tcpak['name'] = 'lib%s.so' %libname\n\n\t\t\telse:\n\n\t\t\t\tif cbuild:\n\t\t\t\t\t#gcc: fatal error: cannot specify -o with -c, -S or -E with multiple files\n\t\t\t\t\t#cmd.extend(cbuild) ## extra c files `/some/path/*.c`\n\t\t\t\t\traise RuntimeError('TODO fix building multiple .c files at once using gcc option -o')\n\n\t\t\t\tcmd.extend(['-o', object_path ])\n\n\t\t\t\tprint('========== compiling C static library =========')\n\t\t\t\tprint(' '.join(cmd))\n\t\t\t\tsubprocess.check_call( cmd )\n\t\t\t\tprint('========== ar : staticlib ==========')\n\t\t\t\tcmd = ['ar', 'rcs', static_path, object_path]\n\t\t\t\tsubprocess.check_call( cmd )\n\t\t\t\tcpak['staticlib'] = libname+'.a'\n\t\t\t\tcpak['name'] = libname+'.a'\n\n\n\tif modules['c++']:\n\t\tlinks = []\n\t\tidirs = []\n\t\tsource = []\n\t\tdefines = []\n\t\tmods_sorted_by_index = sorted(modules['c++'], key=lambda mod: mod.get('index'))\n\t\tmainmod = None\n\t\tbuilddir = tempfile.gettempdir()\n\t\t#compile_mode = 'binary'\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tif 'tag' in mod and mod['tag'] and ( mod['tag'].endswith('.hpp') or mod['tag'].endswith('.hpp') ):\n\t\t\t\t## allows plain header files to be included in build directory ##\n\t\t\t\topen(\n\t\t\t\t\tos.path.join(builddir, mod['tag']), 'wb'\n\t\t\t\t).write( mod['code'] )\n\t\t\t\toutput['c++'].append( mod )\n\t\t\telse:\n\t\t\t\tsource.append( mod['code'] )\n\n\t\t\tif 'name' in mod and mod['name']=='main':\n\t\t\t\tmainmod = mod\n\t\t\telif mainmod is None:\n\t\t\t\tmainmod = mod\n\t\t\tif 'links' in mod:\n\t\t\t\tlinks.extend(mod['links'])\n\t\t\tif 'include-dirs' in mod:\n\t\t\t\tidirs.extend(mod['include-dirs'])\n\t\t\tif 'defines' in mod:\n\t\t\t\tdefines.extend(mod['defines'])\n\n\t\t\t#if 'compile-mode' in mod:\n\t\t\t#\tcompile_mode = mod['compile-mode']\n\n\t\t\tif 'tag' in mod and mod['tag'] and '.' not in mod['tag']:\n\t\t\t\texename = mod['tag']\n\n\t\ttmpfile = builddir + '/rusthon-c++-build.cpp'\n\t\tdata = '\\n'.join(source)\n\t\topen(tmpfile, 'wb').write( data )\n\t\tcmd = ['g++']\n\n\t\tif compile_mode=='binary':\n\t\t\tcmd.extend(['-O3', '-fprofile-generate', '-march=native', '-mtune=native', '-I'+tempfile.gettempdir()])\n\n\t\tcmd.append('-Wl,-rpath,/usr/local/lib/') ## extra user installed dynamic libs\n\t\tcmd.append('-Wl,-rpath,./') ## can not load dynamic libs from same directory without this\n\t\tcmd.append(tmpfile)\n\n\t\tif '/' in exename and not os.path.isdir( os.path.join(builddir,os.path.split(exename)[0]) ):\n\t\t\tos.makedirs(os.path.join(builddir,os.path.split(exename)[0]))\n\n\t\tif compile_mode == 'binary':\n\t\t\tcmd.extend(['-o', os.path.join(builddir,exename)])\n\t\telif compile_mode == 'dynamiclib':\n\t\t\tcmd.extend(\n\t\t\t\t['-shared', '-fPIC']\n\t\t\t)\n\t\t\texename += '.so'\n\t\t\tcmd.extend(['-o', os.path.join(builddir,exename)])\n\n\t\tcmd.extend(\n\t\t\t['-pthread', '-std=c++11' ]\n\t\t)\n\n\t\tfor D in defines:\n\t\t\tcmd.append('-D%s' %D)\n\n\t\tif nuitka:\n\t\t\t## note: linking happens after the object-bin above is created `-o ruston-c++-bin`,\n\t\t\t## fixes the error: undefined reference to `_PyThreadState_Current', etc.\n\t\t\t#if not nuitka_include_path:\n\t\t\t#\tnuitka_include_path = '/usr/local/lib/python2.7/dist-packages/nuitka/build/include'\n\t\t\t#cmd.append('-I'+nuitka_include_path)\n\t\t\tcmd.append('-I/usr/include/python2.7')\n\t\t\tcmd.append('-lpython2.7')\n\n\t\tif idirs:\n\t\t\tfor idir in idirs:\n\t\t\t\tcmd.append('-I'+idir)\n\n\t\tif links:\n\t\t\tfor lib in links:\n\t\t\t\tcmd.append('-l'+lib)\n\n\t\t## always link to libdl, external libraries may require dl_open, etc.\n\t\tcmd.append('-ldl')\n\n\n\t\tif link or giws:\n\n\t\t\tif giws: ## link to the JVM if giws bindings were compiled ##\n\t\t\t\tcmd.append('-ljvm')\n\n\t\t\t\tos.environ['LD_LIBRARY_PATH']=''\n\t\t\t\t#for jrepath in 'include include/linux jre/lib/i386 jre/lib/i386/client/'.split():\n\t\t\t\tfor jrepath in 'include include/linux'.split():\n\t\t\t\t\tcmd.append('-I%s/%s' %(os.environ['JAVA_HOME'], jrepath))\n\t\t\t\tfor jrepath in 'jre/lib/amd64 jre/lib/amd64/server/'.split():\n\t\t\t\t\tcmd.append('-L%s/%s' %(os.environ['JAVA_HOME'], jrepath))\n\t\t\t\t\tos.environ['LD_LIBRARY_PATH'] += ':%s/%s'%(os.environ['JAVA_HOME'], jrepath)\n\t\t\t\t#raise RuntimeError(os.environ['LD_LIBRARY_PATH'])\n\n\t\t\t#else: ## TODO fix jvm with static c libs\n\t\t\t#\tcmd.append('-static')\n\n\t\t\tif link: ## c staticlibs or giws c++ wrappers ##\n\t\t\t\tcmd.append('-L' + tempfile.gettempdir() + '/.')\n\t\t\t\tfor libname in link:\n\t\t\t\t\tcmd.append('-l'+libname)\n\n\t\tprint('========== g++ : compile main ==========')\n\t\tprint(' '.join(cmd))\n\t\tsubprocess.check_call( cmd )\n\t\tmainmod['build'] = {\n\t\t\t'source':data, \n\t\t\t'binary':tempfile.gettempdir() + '/' + exename, \n\t\t\t'name':exename\n\t\t}\n\t\tif compile_mode == 'binary':\n\t\t\toutput['c++'].append( mainmod['build'] )\n\t\t\toutput['executeables'].append(tempfile.gettempdir() + '/' + exename)\n\t\telse:\n\t\t\toutput['datafiles'][ exename ] = open(tempfile.gettempdir() + '/' + exename, 'rb').read()\n\n\tif python_main['script']:\n\t\tpython_main['script'] = '\\n'.join(python_main['script'])\n\t\toutput['python'].append( python_main )\n\n\tif modules['bazel']:\n\t\t# http://bazel.io/docs/build-ref.html#workspaces\n\t\t## a WORKSPACE file is required, even if empty.\n\t\ttmpdir = tempfile.gettempdir()\n\t\topen(tmpdir+'/WORKSPACE', 'wb')\n\n\t\tfor filename in output['datafiles'].keys():\n\t\t\topen(tmpdir+'/'+filename, 'wb').write(output['datafiles'][filename])\n\n\t\tbazelbuilds = []\n\t\tmods_sorted_by_index = sorted(modules['bazel'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tbazelconfig = mod['code']\n\t\t\topen(tmpdir+'/BUILD', 'wb').write(bazelconfig)\n\t\t\tfor chk in bazelconfig.split(','):\n\t\t\t\tchk = chk.strip()\n\t\t\t\twords = chk.split()\n\t\t\t\tif chk.endswith('\"') and 'name' in words and '=' in words:\n\t\t\t\t\tchk = chk.split()\n\t\t\t\t\tbazelbuilds.append(chk[-1][1:-1])\n\n\n\t\tassert len(bazelbuilds)==1\n\t\tbuildname = bazelbuilds[0]\n\t\t#subprocess.check_call(['bazel', 'build', ':'+buildname], cwd=tmpdir)\n\t\tsubprocess.check_call(['bazel', 'run', ':'+buildname], cwd=tmpdir)\n\n\tif gyp_builds:\n\t\ttmpdir = tempfile.gettempdir()\n\t\tfor gname in gyp_builds.keys():\n\t\t\tgbuild = gyp_builds[gname]\n\t\t\tif gbuild['src']:\n\t\t\t\topen(tmpdir+'/binding.gyp', 'wb').write(gbuild['gyp'])\n\t\t\t\topen(tmpdir+'/'+gname, 'wb').write( gbuild['src'] )\n\t\t\t\tsubprocess.check_call(['nw-gyp', 'configure', '--target=0.12.3'], cwd=tmpdir)\n\t\t\t\tsubprocess.check_call(['nw-gyp', 'build'], cwd=tmpdir)\n\n\t\t\t\tnode_module = open(tmpdir+'/build/Release/binding.node', 'rb').read()\n\t\t\t\toutput['datafiles']['binding.node'] = node_module\n\n\n\treturn output", "metadata": "root.build", "header": "['module', '___EOS___']", "index": 517 }, { "content": "def get_first_build_from_package(package):\n\tfor lang in 'rust c++ go javascript python html verilog java nim dart lua'.split():\n\t\tfor pak in package[lang]:\n\t\t\treturn pak", "metadata": "root.get_first_build_from_package", "header": "['module', '___EOS___']", "index": 1456 }, { "content": "def save_tar( package, path='build.tar' ):\n\timport tarfile\n\timport StringIO\n\ttar = tarfile.TarFile(path,\"w\")\n\n\tif package['datadirs']:\n\t\tfor datadir in package['datadirs']:\n\t\t\tif os.path.isdir(datadir):\n\t\t\t\tfor name in os.listdir(datadir):\n\t\t\t\t\ta = os.path.join(datadir,name)\n\t\t\t\t\ttar.add(a) ## files and folders\n\t\t\telif os.path.isfile(datadir):\n\t\t\t\ttar.add(datadir)\n\n\tif package['datafiles']:\n\t\tfor fpath in package['datafiles']:\n\t\t\tfdata = package['datafiles'][fpath]\n\t\t\ts = StringIO.StringIO()\n\t\t\ts.write( fdata )\n\t\t\ts.seek(0)\n\t\t\tti = tarfile.TarInfo(name=fpath)\n\t\t\tti.size=len(s.buf)\n\t\t\ttar.addfile(tarinfo=ti, fileobj=s)\n\n\texts = {'rust':'.rs', 'c++':'.cpp', 'c#':'.cs', 'javascript':'.js', 'json':'.json', 'python':'.py', 'go':'.go', 'html': '.html', 'verilog':'.sv', 'nim':'.nim', 'java':'.java', 'dart':'.dart', 'lua':'.lua'}\n\tfor lang in 'rust c c++ c# go javascript json python xml html verilog java nim dart lua'.split():\n\t\tfor info in package[lang]:\n\t\t\tname = 'untitled'\n\t\t\tif 'name' in info and info['name']:\n\t\t\t\tname = info['name']\n\n\t\t\tsource = False\n\t\t\tis_bin = False\n\t\t\ts = StringIO.StringIO()\n\t\t\tif 'dynamiclib' in info:\n\t\t\t\ts.write(open(info['dynamiclib'],'rb').read())\n\t\t\t\tif 'source' in info:\n\t\t\t\t\tsource = info['source']\n\t\t\telif 'staticlib' in info:\n\t\t\t\ts.write(open(info['staticlib'],'rb').read())\n\t\t\t\tif 'source' in info:\n\t\t\t\t\tsource = info['source']\n\t\t\telif 'binary' in info:\n\t\t\t\ts.write(open(info['binary'],'rb').read())\n\t\t\t\tsource = info['source']\n\t\t\t\tis_bin = True\n\t\t\telif 'code' in info:\n\t\t\t\tif lang=='verilog': print(info['code']) ## just for testing.\n\t\t\t\ts.write(info['code'].encode('utf-8'))\n\t\t\telif 'script' in info:\n\t\t\t\ts.write(info['script'])\n\t\t\ts.seek(0)\n\n\t\t\tif not is_bin and not source and not name.endswith( exts[lang] ) and '.' not in name:\n\t\t\t\tname += exts[lang]\n\n\t\t\tti = tarfile.TarInfo(name=name)\n\t\t\tti.size=len(s.buf)\n\t\t\tif is_bin:\n\t\t\t\tti.mode = 0o777\n\t\t\ttry:\n\t\t\t\ttar.addfile(tarinfo=ti, fileobj=s)\n\t\t\texcept UnicodeEncodeError as err:\n\t\t\t\ts.seek(0)\n\t\t\t\tprint s.getvalue()\n\t\t\t\traise err\n\n\t\t\tif source:\n\t\t\t\ts = StringIO.StringIO()\n\t\t\t\ts.write(source)\n\t\t\t\ts.seek(0)\n\t\t\t\tif 'source-name' in info:\n\t\t\t\t\tti = tarfile.TarInfo( name = info['source-name'] )\n\t\t\t\telse:\n\t\t\t\t\tti = tarfile.TarInfo( name = name + '-source' + exts[lang] )\n\t\t\t\tti.size=len(s.buf)\n\t\t\t\ttar.addfile(tarinfo=ti, fileobj=s)\n\n\ttar.close()", "metadata": "root.save_tar", "header": "['module', '___EOS___']", "index": 1461 }, { "content": "def main():\n\tif len(sys.argv)==1 or '--help' in sys.argv:\n\t\tprint('usage: ./rusthon.py [python files] [markdown files] [tar file] [--release] [--run=] [--data=]')\n\t\tprint('\t\t[tar file] is the optional name of the output tar that contains the build')\n\t\tprint\n\t\tprint('\t\tsource files, transpiled source, and output binaries.')\n\t\tprint\n\t\tprint('\t\t--release generates optimized output without extra runtime checks')\n\t\tprint\n\t\tprint('\t\t--run is given a list of programs to run, \"--run=a.py,b.py\"')\n\t\tprint('\t\ta.py and b.py can be run this way by naming the code blocks in the markdown')\n\t\tprint('\t\tusing the tag syntax \"@a.py\" on the line before the code block.')\n\t\tprint\n\t\tprint('\t\t--data is given a list of directories to include in the build dir and tarfile.')\n\t\tprint\n\t\tprint('\t\t--obfuscate produces random names for unicode functions and variables.')\n\t\tprint\n\t\tprint('\t\t--literate-unicode enables unicode variables names to be output for the javascript backend.')\n\t\tprint\n\t\tprint('\t\t--convert2python=MYOUTPUT strips away static type annotations, to run your script in regular Python.')\n\t\tprint\n\t\tprint('\t\t--anaconda run scripts with Anaconda Python, must be installed to ~/anaconda')\n\t\tprint\n\t\tprint('\t\t--transparent linux and NW.js only (forces window transparency and disables GPU acceleration)')\n\t\tprint\n\t\tprint('\t\t--debug-inter print intermediate translation code and then exit.')\n\t\tprint\n\t\tprint('\t\tnote: when using regular python files (.py) as input instead of markdown (.md)')\n\t\tprint('\t\tyou can use these extra options to set which backend is used by the transpiler:')\n\t\tfor backend in '--c++ --javascript --go --rust'.split():\n\t\t\tprint('\t\t'+backend)\n\t\treturn\n\n\tmodules = new_module()\n\n\tsave = False\n\tpaths = []\n\tscripts = []\n\tmarkdowns = []\n\tgen_md = False\n\toutput_tar = 'rusthon-build.tar'\n\toutput_dir = None\n\toutput_file = None\n\tlaunch = []\n\tdatadirs = []\n\tj2r = False\n\tanaconda = False\n\tconvert2py = False\n\n\tfor arg in sys.argv[1:]:\n\t\tif os.path.isdir(arg):\n\t\t\tpaths.append(arg)\n\t\telif arg.startswith('--data='):\n\t\t\tdatadirs.extend( arg.split('=')[-1].split(',') )\n\t\telif arg.startswith('--run='):\n\t\t\tlaunch.extend( arg.split('=')[-1].split(',') )\n\t\t\tsave = True\n\t\telif arg.startswith('--output='):\n\t\t\toutput_file = arg.split('=')[-1]\n\t\telif arg.startswith('--output-dir='):\n\t\t\toutput_dir = arg.split('=')[-1]\n\t\t\tif output_dir.startswith('~'):\n\t\t\t\toutput_dir = os.path.expanduser(output_dir)\n\t\telif arg.startswith('--convert2python='):\n\t\t\tconvert2py = arg.split('=')[-1]\n\n\t\telif arg.endswith('.py'):\n\t\t\tscripts.append(arg)\n\t\telif arg.endswith('.md'):\n\t\t\tmarkdowns.append(arg)\n\t\telif arg.endswith('.tar'):\n\t\t\toutput_tar = arg\n\t\t\tsave = True\n\t\telif arg =='--generate-markdown':\n\t\t\tgen_md = True\n\t\telif arg == '--tar':\n\t\t\tsave = True\n\t\telif arg == '--java2rusthon':\n\t\t\tj2r = True\n\t\telif arg == '--anaconda':\n\t\t\tanaconda = True\n\n\tdatadirs = [os.path.expanduser(dd) for dd in datadirs]\n\n\tif j2r:\n\t\tfor path in paths:\n\t\t\tm = convert_to_markdown_project(path, java=True, java2rusthon=True)\n\t\t\traise RuntimeError('TODO: %s'%m)\n\n\tif gen_md:\n\t\tfor path in paths:\n\t\t\tmds = convert_to_markdown_project(path)\n\t\t\tif not output_file:\n\t\t\t\traise RuntimeError('%s \\n ERROR: no output file given `--output=myproject.md`'%mds)\n\t\t\telif os.path.isdir(output_file):\n\t\t\t\t## write as multiple markdowns into directory\n\t\t\t\tfor m in mds:\n\t\t\t\t\tif m['name'].count('.')==1:\n\t\t\t\t\t\tmname = m['name'].split('.')[0] + '.md'\n\t\t\t\t\telse:\n\t\t\t\t\t\tmname = m['name'] + '.md'\n\t\t\t\t\tmpath = os.path.join(output_file, mname)\n\t\t\t\t\tprint('writing-> %s'%mpath)\n\t\t\t\t\topen(mpath, 'wb').write(m['markdown'])\n\t\t\telse:\n\t\t\t\tif not output_file.endswith('.md'):\n\t\t\t\t\toutput_file += '.md'\n\t\t\t\tmd = '\\n'.join([m['markdown'] for m in mds])\n\t\t\t\topen(output_file, 'wb').write(md)\n\t\t\tsys.exit()\n\n\n\tif convert2py:\n\t\t## strips away rusthon type annotations ##\n\t\tif not len(scripts):\n\t\t\traise RuntimeError('the option --convert2python=myoutput requires an input script')\n\t\tif len(scripts)!=1:\n\t\t\traise RuntimeError('the option --convert2python=myoutput requires a single input script')\n\t\ta = typedpython.transform_source(\n\t\t\topen(scripts[0],'rb').read(), \n\t\t\tstrip=True\n\t\t)\n\t\topen(convert2py, 'wb').write(a)\n\t\tsys.exit()\n\n\tbase_path = None\n\tsingleout = None\n\tfor path in scripts:\n\t\t## note: .decode('utf-8') is not required here,\n\t\t## should also check the strip to ensure the user has not\n\t\t## used unicode strings starting with the `u` prefix,\n\t\t## because that will break the translator, because it\n\t\t## promotes those strings to unicode objects in the AST (which is written in Python2)\n\t\tscript = open(path,'rb').read()\n\t\tif '--c++' in sys.argv: script = '#backend:c++\\n'+script\n\t\telif '--javascript' in sys.argv: script = '#backend:javascript\\n'+script\n\t\telif '--rust' in sys.argv: script = '#backend:rust\\n'+script\n\t\telif '--go' in sys.argv: script = '#backend:go\\n'+script\n\t\telif '--dart' in sys.argv: raise RuntimeError('dart backend removed')\n\t\telif '--lua' in sys.argv: raise RuntimeError('lua backend removed')\n\t\telif '--verilog' in sys.argv: script = '#backend:verilog\\n'+script\n\t\telse: script = '#backend:javascript\\n'+script\n\n\t\tfpath,fname = os.path.split(path)\n\t\ttag = fname.split('.')[0]\n\t\tsinglemod = {'name':'main', 'tag':tag, 'code':script}\n\t\tmodules['rusthon'].append( singlemod )\n\t\tif base_path is None:\n\t\t\tbase_path = os.path.split(path)[0]\n\t\tif singleout is None and output_file:\n\t\t\tsingleout = singlemod\n\n\tfor path in markdowns:\n\t\timport_md( path, modules=modules )\n\t\tif base_path is None:\n\t\t\tbase_path = os.path.split(path)[0]\n\n\tpackage = build(modules, base_path, datadirs=datadirs )\n\tif singleout:\n\t\tpak = get_first_build_from_package(package)\n\t\tif 'source' in pak:\n\t\t\topen(output_file, 'wb').write(pak['source'])\n\t\telif 'code' in pak:\n\t\t\topen(output_file, 'wb').write(pak['code'])\n\t\telif 'script' in pak:\n\t\t\topen(output_file, 'wb').write(pak['script'])\n\t\telse:\n\t\t\traise RuntimeError(pak)\n\t\tprint('saved output to: %s'%output_file)\n\n\telif not save:\n\t\ttmpdir = tempfile.gettempdir()\n\t\t## copy jar and other extra libraries files files ##\n\t\tfor p in datadirs:\n\t\t\t## saves jar and other files like dynamic libraries,\n\t\t\t## needed to do quick testing.\n\t\t\tif '.' in p:\n\t\t\t\tdpath,dname = os.path.split(p)\n\t\t\t\topen(os.path.join(tmpdir,dname),'wb').write(open(p,'rb').read())\n\n\t\tfor exe in package['executeables']:\n\t\t\tprint('running: %s' %exe)\n\t\t\tsubprocess.check_call(\n\t\t\t\texe,\n\t\t\t\tcwd=tmpdir ## jvm needs this to find the .class files\n\t\t\t)\n\n\t\tif package['html']:\n\t\t\tfor i,page in enumerate(package['html']):\n\t\t\t\ttname = 'rusthon-webpage%s.html' %i\n\n\t\t\t\tif 'name' in page and page['name']:\n\t\t\t\t\ttname = page['name']\n\n\t\t\t\ttmp = tempfile.gettempdir() + '/' + tname\n\t\t\t\tif sys.platform=='darwin': ## force /tmp directory on OSX, makes debugging the output simpler\n\t\t\t\t\ttmp = '/tmp/' + tname\n\n\t\t\t\t## note in Chrome UTF-8 javascript will fail with this error: \n\t\t\t\t## `Unexpected token ILLEGAL` with unicode variables\n\t\t\t\t## the file must be written as UTF-16.\n\t\t\t\t## http://stackoverflow.com/questions/22543354/how-well-is-node-js-support-for-unicode\n\t\t\t\t#open(tmp, 'wb').write( page['code'].encode('utf-8') )\n\t\t\t\topen(tmp, 'wb').write( page['code'].encode('utf-16') )\n\n\t\t\t\tif i<len(package['html'])-1: ## only launch the last html file.\n\t\t\t\t\tpass\n\t\t\t\telif sys.platform=='darwin' and not nodewebkit_runnable: ## hack for OSX\n\t\t\t\t\tsubprocess.call(['open', tmp])\n\t\t\t\telif nodewebkit_runnable:\n\t\t\t\t\t## nodewebkit looks for `package.json` in the folder it is given ##\n\t\t\t\t\tnwcfg = '{\"name\":\"test\", \"main\":\"%s\", ' %os.path.split(tmp)[1]\n\t\t\t\t\tif '--frameless' in sys.argv:\n\t\t\t\t\t\tnwcfg += '\"window\":{\"width\":1200, \"height\":680, \"toolbar\":false, \"frame\":false}}'\n\t\t\t\t\telif '--desktop' in sys.argv:\n\t\t\t\t\t\t## note as_desktop is broken in new NW.js\n\t\t\t\t\t\t## https://github.com/nwjs/nw.js/issues/2833\n\t\t\t\t\t\tnwcfg += '\"window\":{\"width\":1200, \"height\":680, \"toolbar\":false, \"as_desktop\":true, \"frame\":false}}'\n\t\t\t\t\telse:\n\t\t\t\t\t\tnwcfg += '\"window\":{\"width\":1200, \"height\":680, \"toolbar\":false}}'\n\n\t\t\t\t\topen(os.path.join(tmpdir,\"package.json\"),'wb').write(nwcfg)\n\t\t\t\t\tnwcmd = [nodewebkit]\n\t\t\t\t\tif '--v8-natives' in sys.argv:\n\t\t\t\t\t\tnwcmd.append('--allow-natives-syntax')\n\t\t\t\t\tif sys.platform=='linux2' and '--transparent' in sys.argv:\n\t\t\t\t\t\tnwcmd.extend(['--enable-transparent-visuals', '--disable-gpu'])\n\t\t\t\t\tnwcmd.append(tmpdir)\n\t\t\t\t\tsubprocess.Popen(nwcmd, cwd=tmpdir)\n\t\t\t\telse:\n\t\t\t\t\twebbrowser.open(tmp)\n\n\t\telif package['javascript']:\n\t\t\ttmpdir = tempfile.gettempdir()\n\t\t\tfor pak in package['javascript']:\n\t\t\t\tfname = pak['name']\n\t\t\t\tif fname is None:\n\t\t\t\t\tfname = 'rusthon-temp.js'\n\t\t\t\telif not fname.endswith('.js'):\n\t\t\t\t\tfname += '.js'\n\n\t\t\t\tfpath = os.path.join(tmpdir, fname)\n\t\t\t\topen(fpath, 'wb').write( pak['script'] )\n\t\t\t\t#xxx = pak['script'].decode('utf-8')\n\t\t\t\t#open(fpath, 'wb').write( xxx.encode('utf-16') ) ## TODO fix nodejs unicode\n\t\t\t\t#codecs.open(fpath, 'w', 'utf-8').write( pak['script'] ) ## TODO fix nodejs unicode\n\t\t\t\tif '--v8-natives' in sys.argv:\n\t\t\t\t\tsubprocess.check_call([nodejs_exe, '--allow-natives-syntax', fpath])\n\t\t\t\telse:\n\t\t\t\t\tsubprocess.check_call([nodejs_exe, fpath])\n\n\telse:\n\t\tsave_tar( package, output_tar )\n\t\tprint('saved build to:')\n\t\tprint(output_tar)\n\n\t\tif launch:\n\t\t\ttmpdir = output_dir or tempfile.gettempdir()\n\t\t\ttmptar = os.path.join(tmpdir, 'temp.tar')\n\t\t\topen(tmptar, 'wb').write(\n\t\t\t\topen(output_tar, 'rb').read()\n\t\t\t)\n\t\t\tsubprocess.check_call( ['tar', '-xvf', tmptar], cwd=tmpdir )\n\n\t\t\trun = subprocess.call\n\n\t\t\tfor name in launch:\n\t\t\t\tif name==launch[-1]:\n\t\t\t\t\trun = subprocess.check_call\n\t\t\t\telse:\n\t\t\t\t\trun = subprocess.Popen\n\n\t\t\t\tif name.endswith('.py'):\n\t\t\t\t\tfirstline = open(os.path.join(tmpdir, name), 'rb').readlines()[0]\n\t\t\t\t\tpython = 'python'\n\t\t\t\t\tif firstline.startswith('#!'):\n\t\t\t\t\t\tif 'python3' in firstline:\n\t\t\t\t\t\t\tpython = 'python3'\n\n\t\t\t\t\tif anaconda:\n\t\t\t\t\t\t## assume that the user installed anaconda to the default location ##\n\t\t\t\t\t\tanabin = os.path.expanduser('~/anaconda/bin')\n\t\t\t\t\t\tif not os.path.isdir(anabin):\n\t\t\t\t\t\t\traise RuntimeError('Anaconda Python not installed to default location: %s' %anabin)\n\n\t\t\t\t\t\trun( [os.path.join(anabin,python), name], cwd=tmpdir )\n\n\t\t\t\t\telse:\n\t\t\t\t\t\trun( [python, name], cwd=tmpdir )\n\n\t\t\t\telif name.endswith('.js'):\n\t\t\t\t\trun( ['node', name], cwd=tmpdir, env={'NODE_PATH':'/usr/lib/node_modules/'} )\n\n\t\t\t\telif name.endswith('.nim'):\n\t\t\t\t\trun( ['nim', 'compile', '--run', name], cwd=tmpdir )\n\n\t\t\t\telif name.endswith('.go'):\n\t\t\t\t\trun( ['go', 'run', name], cwd=tmpdir )\n\n\t\t\t\telif name.endswith('.lua'):\n\t\t\t\t\trun( ['luajit', name], cwd=tmpdir )\n\n\t\t\t\telif name.endswith('.dart'):\n\t\t\t\t\tdartbin = os.path.expanduser('~/dart-sdk/bin/dart')\n\t\t\t\t\trun( [dartbin, name], cwd=tmpdir )\n\n\t\t\t\telif name.endswith('.html'):\n\t\t\t\t\tif sys.platform=='darwin':\n\t\t\t\t\t\tsubprocess.call(['open', tmpdir+'/'+name])\n\t\t\t\t\telif nodewebkit_runnable:\n\t\t\t\t\t\traise RuntimeError('todo nodewebkitxx')\n\t\t\t\t\t\tsubprocess.call([nodewebkit, tmp], cwd=tmpdir)\n\t\t\t\t\telse:\n\t\t\t\t\t\twebbrowser.open(tmpdir+'/'+name)\n\n\t\t\t\telse:\n\t\t\t\t\tprint 'running: %s' %name\n\t\t\t\t\trun( [os.path.join(tmpdir,name)], cwd=tmpdir )", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 1567 }, { "content": "class rusthon(object):", "metadata": "root.rusthon", "header": "['module', '___EOS___']", "index": 1887 }, { "content": "\t@classmethod\n\tdef translate( cls, code, mode='markdown' ):\n\t\tif mode=='javascript':\n\t\t\tjs = compile_js( code, '/tmp', main_name='main' )\n\t\t\treturn js['main']\n\n\t\telif mode=='c++':\n\t\t\tpyjs = python_to_pythonjs(code, cpp=True)\n\t\t\tpak = translate_to_cpp(\n\t\t\t\tpyjs, \n\t\t\t\tinsert_runtime=False\n\t\t\t)\n\t\t\t## pak contains: c_header and cpp_header\n\t\t\treturn pak['main']\n\n\t\telif mode=='go':\n\t\t\tpyjs = python_to_pythonjs(code, go=True)\n\t\t\treturn translate_to_go( pyjs )\n\n\t\telif mode=='rust':\n\t\t\tpyjs = python_to_pythonjs(code, rust=True)\n\t\t\treturn translate_to_rust( pyjs )\n\n\t\telse:\n\t\t\t#modules = new_module()\n\t\t\t#import_md( path, modules=modules )\n\t\t\tbase_path = None\n\t\t\tpackage = build(modules, base_path )\n\t\t\traise RuntimeError(package)\n\t\t\treturn ", "metadata": "root.rusthon.translate", "header": "['class', 'rusthon', '(', 'object', ')', ':', '___EOS___']", "index": 1888 }, { "content": "def bootstrap_rusthon():\n\tglobal BOOTSTRAPED\n\tlocaldir = os.path.dirname(unicode(os.path.realpath(__file__), sys.getfilesystemencoding()))\n\t#raise RuntimeError(localdir)\n\tmods = new_module()\n\timport_md( os.path.join(localdir,'src/main.md'), modules=mods )\n\tsrc = []\n\tmods_sorted_by_index = sorted(mods['python'], key=lambda mod: mod.get('index'))\n\tfor mod in mods_sorted_by_index: ## this is simplified because rusthon's source is pure python\n\t\tsrc.append( mod['code'] )\n\tsrc = '\\n'.join(src)\n\tBOOTSTRAPED = src\n\n\tif '--dump' in sys.argv: open('/tmp/bootstrap-rusthon.py', 'wb').write(src.encode('utf-8'))\n\texec(src, globals())\n\n\tif '--test' in sys.argv:\n\t\ttest_typedpython() ## runs some basic tests on the extended syntax\n\n\tif '--runtime' in sys.argv:\n\t\tprint('creating new runtime: pythonjs.js')\n\t\tjsruntime = generate_js_runtime()\n\t\tif os.path.isdir('./pythonjs'):\n\t\t\tprint 'saving runtime to pythonjs/pythonjs.js'\n\t\t\topen('pythonjs/pythonjs.js', 'wb').write( jsruntime )\n\t\treturn jsruntime", "metadata": "root.bootstrap_rusthon", "header": "['module', '___EOS___']", "index": 1919 } ]
[ { "span": "import os, sys, subprocess, hashlib, time", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 41 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "0.", "9.9", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", ",_", "sys_", ",_", "subprocess_", ",_", "hashlib_", ",_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "webbrowser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "if", " ", "install", "ed", " ", "as", " ", "a", " ", "symbolic", " ", "link", ",", " ", "this", " ", "ensure", "s", " ", "thing", "s", " ", "can", " ", "still", " ", "be", " ", "bootstrapp", "ed", " ", "from", " ", "the", " ", "`", "src", "`", " ", "subfolder", "_", "\\u\\u\\uNL\\u\\u\\u_", "RUS", "THO", "N", "\\u", "LIB", "\\u", "ROOT_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "unicode_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "sys_", "._", "getfile", "system", "encoding_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "GO", "\\u", "EXE", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "usr", "/", "bin", "/", "go", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "GO", "\\u", "EXE", "_", "=_", "'/", "usr", "/", "bin", "/", "go", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "usr", "/", "local", "/", "go", "/", "bin", "/", "go", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "GO", "\\u", "EXE", "_", "=_", "'/", "usr", "/", "local", "/", "go", "/", "bin", "/", "go", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "path_", "._", "isfile_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/", "go", "/", "bin", "/", "go", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "GO", "\\u", "EXE", "_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/", "go", "/", "bin", "/", "go", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node", "webkit", "\\u", "runnable", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "webkit", "_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/", "nw", "js", "-", "v", "0.12", ".2", "-", "linux", "-", "x6", "4", "/", "nw", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "node", "webkit", "_", ")_", ":_", "node", "webkit", "\\u", "runnable", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "node", "webkit", "_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/", "nw", "js", "-", "v", "0.12", ".3", "-", "linux", "-", "x6", "4", "/", "nw", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "node", "webkit", "_", ")_", ":_", "node", "webkit", "\\u", "runnable", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "'", "dar", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "node", "webkit", "_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/", "nw", "js", "-", "v", "0.12", ".3", "-", "os", "x", "-", "x6", "4", "/", "nw", "js", ".", "app", "/", "Conten", "ts", "/", "Mac", "OS", "/", "nw", "js", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "node", "webkit", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "node", "webkit", "\\u", "runnable", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "special", " ", "case", " ", "for", " ", "linux", ",", " ", "just", " ", "for", " ", "debugg", "ing", ",", " ", "look", " ", "for", " ", "google", "-", "chrome", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "if", " ", "found", " ", "then", " ", "use", " ", "it", " ", "to", " ", "launch", " ", "tests", ",", " ", "with", " ", "the", " ", "--", "disable", "-", "gpu", "-", "sandbox_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "other", "wis", "e", " ", "web", "gl", " ", "may", " ", "fail", " ", "on", " ", "some", " ", "graphic", "s", " ", "cards", ",", " ", "this", " ", "is", " ", "danger", "ous_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "and", " ", "can", " ", "lock", "up", " ", "the", " ", "desk", "top", ",", " ", "this", " ", "was", " ", "an", " ", "issue", " ", "on", " ", "Fe", "dor", "a2", "1", " ", "with", " ", "intel", " ", "graphic", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "but", " ", "is", " ", "no", " ", "long", "er", " ", "an", " ", "issue", " ", "in", " ", "Fe", "dor", "a2", "2", ".", " ", " ", "Enable", " ", "this", " ", "at", " ", "your", " ", "own", " ", "risk", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "CHROM", "E", "\\u", "EXE", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "os", ".", "path", ".", "isfi", "le", "('", "/", "opt", "/", "google", "/", "chrome", "-", "unstable", "/", "google", "-", "chrome", "-", "unstable", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "CHROM", "E", "\\u", "EXE", " ", "=", " ", "'/", "opt", "/", "google", "/", "chrome", "-", "unstable", "/", "google", "-", "chrome", "-", "unstable", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "eli", "f", " ", "os", ".", "path", ".", "isfi", "le", "('", "/", "opt", "/", "google", "/", "chrome", "-", "beta", "/", "google", "-", "chrome", "-", "beta", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "CHROM", "E", "\\u", "EXE", " ", "=", " ", "'/", "opt", "/", "google", "/", "chrome", "-", "beta", "/", "google", "-", "chrome", "-", "beta", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "eli", "f", " ", "os", ".", "path", ".", "isfi", "le", "('", "/", "opt", "/", "google", "/", "chrome", "/", "google", "-", "chrome", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "CHROM", "E", "\\u", "EXE", " ", "=", " ", "'/", "opt", "/", "google", "/", "chrome", "/", "google", "-", "chrome", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "on", " ", "fedo", "ra", " ", "node", "js", " ", "command", " ", "is", " ", "`", "node", "`", ",", " ", "but", " ", "on", " ", "other", "s", " ", "it", " ", "can", " ", "be", " ", "`", "node", "js", "`_", "\\u\\u\\uNL\\u\\u\\u_", "node", "js", "\\u", "exe_", "=_", "'", "node", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "usr", "/", "sb", "in", "/", "ax", "25", "-", "node", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "usr", "/", "sb", "in", "/", "node", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "os_", "._", "path_", "._", "realpath_", "(_", "'/", "usr", "/", "sb", "in", "/", "node", "'_", ")_", "==_", "'/", "usr", "/", "sb", "in", "/", "ax", "25", "-", "node", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "node", "js", "\\u", "exe_", "=_", "'", "node", "js", "'_", "\\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_", "JS", "\\u", "WEB", "WORKER", "\\u", "HEADER_", "=_", "u", "'''", "\\", "10", ";", "var", " ", "\\u\\u", "$", "UI", "D", "$\\u", "\\u", " ", "=", " ", "1", ";", "\\", "10", ";", "var", " ", "\\u\\u", "construct", "\\u\\u", " ", "=", " ", "function", "(", "construct", "or", ",", " ", "args", ")", " ", "{", "\\", "10", ";", "\t", "function", " ", "F", "()", " ", "{", "\\", "10", ";", "\t", "\t", "return", " ", "construct", "or", ".", "appl", "y", "(", "this", ",", " ", "args", ");", "\\", "10", ";", "\t", "}", "\\", "10", ";", "\t", "F", ".", "protot", "ype", " ", "=", " ", "construct", "or", ".", "protot", "ype", ";", "\\", "10", ";", "\t", "return", " ", "new", " ", "F", "();", "\\", "10", ";}", ";", "\\", "10", ";", "\\", "10", ";", "var", " ", "\\u\\u", "instance", "s", "\\u\\u", " ", "=", " ", "{};", "\\", "10", ";", "var", " ", "\\u\\u", "bin", "\\u\\u", " ", " ", "=", " ", "null", ";", "\\", "10", ";", "self", ".", "on", "message", " ", "=", " ", "function", " ", "(", "evt", ")", " ", "{", "\\", "10", ";", "\t", "var", " ", "id", ";", "\\", "10", ";", "\t", "if", " ", "(\\u", "\\u", "bin", "\\u\\u)", " ", "{", "\\", "10", ";", "\t", "\t", "var", " ", "bm", "sg", ";", "\\", "10", ";", "\t", "\t", "if", " ", "(\\u", "\\u", "bin", "\\u\\u", ".", "type", "==", "\"", "Float", "32", "Array", "\")", " ", "{", "\\", "10", ";", "\t\t\t", "bm", "sg", " ", "=", " ", "new", " ", "Float", "32", "Array", "(", "evt", ".", "data", ");", "\\", "10", ";", "\t", "\t", "}", " ", "else", " ", "if", " ", "(\\u", "\\u", "bin", "\\u\\u", ".", "type", "==", "\"", "Float", "64", "Array", "\")", " ", "{", "\\", "10", ";", "\t\t\t", "bm", "sg", " ", "=", " ", "new", " ", "Float", "64", "Array", "(", "evt", ".", "data", ");", "\\", "10", ";", "\t", "\t", "}", " ", "//", " ", "TOD", "O", " ", "other", " ", "types", "\\", "10", ";", "\\", "10", ";", "\t", "\t", "if", " ", "(\\u", "\\u", "bin", "\\u\\u", ".", "send", "\\u", "binar", "y", ")", " ", "{", "\\", "10", ";", "\t\t\t", "id", " ", "=", " ", "\\u\\u", "bin", "\\u\\u", ".", "send", "\\u", "binar", "y", ";", "\\", "10", ";", "\t\t\t", "var", " ", "ob", " ", "=", " ", "\\u\\u", "instance", "s", "\\u\\u", "[", "id", "];", "\\", "10", ";", "\t\t\t", "var", " ", "re", " ", "=", " ", "ob", ".", "send", "(", "bm", "sg", ");", "\\", "10", ";", "\t\t\t", "if", " ", "(", "re", " ", "!=", "=", " ", "undefined", ")", " ", "{", "\\", "10", ";", "\t\t\t", "\t", "if", " ", "(", "ob", ".", "send", ".", "return", "s", "==", "\"", "Float", "32", "Array", "\")", " ", "{", "\\", "10", ";", "\t\t\t", "\t", "\t", "self", ".", "post", "Messag", "e", "({", "'", "id", "':", "id", ",", " ", "'", "bin", "':", "ob", ".", "send", ".", "return", "s", "})", ";", "\\", "10", ";", "\t\t\t", "\t", "\t", "self", ".", "post", "Messag", "e", "(", "re", ".", "buffer", ",", " ", "[", "re", ".", "buffer", "])", ";", "\\", "10", ";", "\t\t\t", "\t", "}", " ", "else", " ", "{", "\\", "10", ";", "\t\t\t", "\t", "\t", "self", ".", "post", "Messag", "e", "({", "'", "id", "':", "id", ",", " ", "'", "message", "':", "re", ",", " ", "'", "proto", "':", "ob", ".", "send", ".", "return", "s", "})", ";", "\\", "10", ";", "\t\t\t", "\t", "}", "\\", "10", ";", "\t\t\t", "}", "\\", "10", ";", "\t", "\t", "}", "\\", "10", ";", "\t", "\t", "\\u\\u", "bin", "\\u\\u", " ", "=", " ", "null", ";", "\\", "10", ";", "\t", "\t", "return", ";", "\\", "10", ";", "\t", "}", "\\", "10", ";", "\t", "var", " ", "msg", " ", "=", " ", "evt", ".", "data", ";", "\\", "10", ";", "\\", "10", ";", "\t", "if", " ", "(", "msg", ".", "send", "\\u", "binar", "y", ")", " ", "{", "\\", "10", ";", "\t", "\t", "//", " ", "shou", "ld", " ", "assert", " ", "here", " ", "tha", "t", " ", "\\u\\u", "bin", "\\u\\u", " ", "is", " ", "null", "\\", "10", ";", "\t", "\t", "\\u\\u", "bin", "\\u\\u", " ", "=", " ", "msg", ";", "\\", "10", ";", "\t", "\t", "return", ";", "\\", "10", ";", "\t", "}", "\\", "10", ";", "\t", "if", " ", "(", "msg", "['", "spawn", "'])", " ", "{", "\\", "10", ";", "\t", "\t", "id", " ", "=", " ", "msg", ".", "spawn", ";", "\\", "10", ";", "\t", "\t", "self", ".", "post", "Messag", "e", "({", "debug", ":\"", "SPA", "WN", ":\"", "+", "id", "})", ";", "\\", "10", ";", "\t", "\t", "if", " ", "(\\u", "\\u", "instance", "s", "\\u\\u", "[", "id", "]", " ", "!=", "=", " ", "undefined", ")", " ", "{", "\\", "10", ";", "\t\t\t", "self", ".", "post", "Messag", "e", "({", "debug", ":\"", "SPA", "WN", " ", "ERROR", " ", "-", " ", "exist", "ing", " ", "id", ":\"", "+", "id", "})", ";", "\\", "10", ";", "\\", "10", ";", "\t", "\t", "}", "\\", "10", ";", "\t", "\t", "//", "self", ".", "post", "Messag", "e", "({", "debug", ":\"", "SPA", "WN", "-", "CLASS", ":\"", "+", "msg", "['", "new", "']}", ");", "\\", "10", ";", "\t", "\t", "//", "self", ".", "post", "Messag", "e", "({", "debug", ":\"", "SPA", "WN", "-", "ARG", "S", ":\"", "+", "msg", "['", "args", "']}", ");", "\\", "10", ";", "\t", "\t", "\\u\\u", "instance", "s", "\\u\\u", "[", "id", "]", " ", "=", " ", "\\u\\u", "construct", "\\u\\u", "(", "eval", "(", "msg", "['", "new", "'])", ",", " ", "msg", ".", "args", " ", ");", "\\", "10", ";", "\t", "\t", "\\u\\u", "instance", "s", "\\u\\u", "[", "id", "].", "\\u\\u", "uid", "\\u\\u", " ", "=", " ", "id", ";", "\\", "10", ";", "\t", "}", "\\", "10", ";", "\t", "if", " ", "(", "msg", "['", "send", "'])", " ", "{", "\\", "10", ";", "\t", "\t", "id", " ", "=", " ", "msg", ".", "send", ";", "\\", "10", ";", "\t", "\t", "//", "self", ".", "post", "Messag", "e", "({", "debug", ":\"", "SEND", ":\"", "+", "id", "})", ";", "\\", "10", ";", "\t", "\t", "var", " ", "ob", " ", "=", " ", "\\u\\u", "instance", "s", "\\u\\u", "[", "id", "];", "\\", "10", ";", "\t", "\t", "var", " ", "re", " ", "=", " ", "ob", ".", "send", "(", "msg", ".", "message", ");", "\\", "10", ";", "\t", "\t", "if", " ", "(", "re", " ", "!=", "=", " ", "undefined", ")", " ", "{", "\\", "10", ";", "\t\t\t", "//", "self", ".", "post", "Messag", "e", "({", "debug", ":\"", "SEND", "-", "BACK", ":\"", "+", "re", "})", ";", "\\", "10", ";", "\t\t\t", "self", ".", "post", "Messag", "e", "({", "'", "id", "':", "id", ",", " ", "'", "message", "':", "re", ",", " ", "'", "proto", "':", "ob", ".", "send", ".", "return", "s", "})", ";", "\\", "10", ";", "\t", "\t", "}", " ", "else", " ", "{", "\\", "10", ";", "\t\t\t", "//", "self", ".", "post", "Messag", "e", "({", "debug", ":\"", "SEND", "-", "BACK", "-", "NON", "E", ":\"", "})", ";", "\\", "10", ";", "\t", "\t", "}", "\\", "10", ";", "\t", "}", "\\", "10", ";", "\t", "if", " ", "(", "msg", "['", "call", "'])", " ", "{", "\\", "10", ";", "\t", "\t", "self", ".", "post", "Messag", "e", "({", "\\", "10", ";", "\t\t\t", "'", "CALL", "'", " ", " ", " ", ":", " ", "1", ",", " ", "\\", "10", ";", "\t\t\t", "'", "message", "':", " ", "self", "[", " ", "msg", ".", "call", " ", "].", "appl", "y", "(", "null", ",", "msg", ".", "args", "),", "\\", "10", ";", "\t\t\t", "'", "proto", "'", " ", " ", ":", " ", "self", "[", " ", "msg", ".", "call", " ", "].", "return", "s", "\\", "10", ";", "\t", "\t", "})", ";", "\\", "10", ";", "\t", "}", "\\", "10", ";", "\t", "if", " ", "(", "msg", "['", "call", "meth", "'])", " ", "{", "\\", "10", ";", "\t", "\t", "id", " ", "=", " ", "msg", ".", "id", ";", "\\", "10", ";", "\t", "\t", "//", "self", ".", "post", "Messag", "e", "({", "debug", ":\"", "CALL", "M", ":\"", "+", "id", "})", ";", "\\", "10", ";", "\t", "\t", "var", " ", "ob", " ", "=", " ", "\\u\\u", "instance", "s", "\\u\\u", "[", "id", "];", "\\", "10", ";", "\t", "\t", "if", " ", "(", "typeof", "(", "ob", ")", " ", "==", " ", "\"", "undefined", "\")", " ", "{", "\\", "10", ";", "\t\t\t", "self", ".", "post", "Messag", "e", "({", "debug", ":\"", "invalid", " ", "spawn", " ", "instance", " ", "id", ":\"", "+", "id", "})", ";", "\\", "10", ";", "\t\t\t", "self", ".", "post", "Messag", "e", "({", "debug", ":\"", "instance", "s", ":\"", "+", "Object", ".", "keys", "(\\u", "\\u", "instance", "s", "\\u\\u)", ".", "length", "})", ";", "\\", "10", ";", "\t", "\t", "}", " ", "else", " ", "{", "\\", "10", ";", "\t\t\t", "self", ".", "post", "Messag", "e", "({", "\\", "10", ";", "\t\t\t", "\t", "'", "CALL", "METH", "':", " ", "1", ",", " ", "\\", "10", ";", "\t\t\t", "\t", "'", "message", "'", " ", ":", " ", "ob", "[", "msg", ".", "call", "meth", "].", "appl", "y", "(", "ob", ",", "msg", ".", "args", "),", "\\", "10", ";", "\t\t\t", "\t", "'", "proto", "'", " ", " ", " ", ":", " ", "ob", "[", "msg", ".", "call", "meth", "].", "return", "s", "\\", "10", ";", "\t\t\t", "})", ";", "\\", "10", ";", "\\", "10", ";", "\t", "\t", "}", "\\", "10", ";", "\t", "}", "\\", "10", ";", "\\", "10", ";", "\t", "if", " ", "(", "msg", "['", "get", "'])", " ", "{", "\\", "10", ";", "\t", "\t", "id", " ", "=", " ", "msg", ".", "id", ";", "\\", "10", ";", "\t", "\t", "//", "self", ".", "post", "Messag", "e", "({", "debug", ":\"", "GET", ":\"", "+", "id", "})", ";", "\\", "10", ";", "\t", "\t", "var", " ", "ob", " ", "=", " ", "\\u\\u", "instance", "s", "\\u\\u", "[", "id", "];", "\\", "10", ";", "\t", "\t", "self", ".", "post", "Messag", "e", "({", "'", "GET", "':", "1", ",", " ", "'", "message", "':", "ob", "[", "msg", ".", "get", "]}", ");", "\\", "10", ";", "\t", "}", "\\", "10", ";", "\\", "10", ";}", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "OPENS", "HIFT", "\\u", "PY", "_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'''", "#!", "/", "usr", "/", "bin", "/", "python", "\\", "10", ";", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "\\", "10", ";", "\\", "10", ";", "import", " ", "os", "\\", "10", ";", "\\", "10", ";", "virt", "env", " ", "=", " ", "os", ".", "environ", "['", "OPENS", "HIFT", "\\u", "PYTHON", "\\u", "DIR", "']", " ", "+", " ", "'/", "virt", "env", "/'", "\\", "10", ";", "virtualenv", " ", "=", " ", "os", ".", "path", ".", "join", "(", "virt", "env", ",", " ", "'", "bin", "/", "activat", "e\\u", "this", ".", "py", "')", "\\", "10", ";", "try", ":", "\\", "10", ";", " ", " ", " ", " ", "execfile", "(", "virtualenv", ",", " ", "dict", "(\\u", "\\u", "file", "\\u\\u", "=", "virtualenv", "))\\", "10", ";", "except", " ", "IO", "Error", ":", "\\", "10", ";", " ", " ", " ", " ", "pass", "\\", "10", ";", "#", "\\", "10", ";", "#", " ", "IMPORT", "ANT", ":", " ", "Put", " ", "any", " ", "addition", "al", " ", "include", "s", " ", "belo", "w", " ", "this", " ", "line", ".", " ", " ", "If", " ", "place", "d", " ", "above", " ", "this", "\\", "10", ";", "#", " ", "line", ",", " ", "it", "'", "s", " ", "possib", "le", " ", "require", "d", " ", "librar", "ies", " ", "won", "'", "t", " ", "be", " ", "in", " ", "your", " ", "searcha", "ble", " ", "path", "\\", "10", ";", "#", "\\", "10", ";", "from", " ", "base64", " ", "import", " ", "b64", "decode", "\\", "10", ";", "INDE", "X", "\\u", "HTM", "L", " ", "=", " ", "b64", "decode", "(\"", "%", "s", "\")", "\\", "10", ";'", "''_", ",_", "##", " ", "header_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'''", "\\", "10", ";", "def", " ", "applica", "tion", "(", "environ", ",", " ", "start", "\\u", "response", "):", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "ctype", " ", "=", " ", "'", "text", "/", "plain", "'", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "environ", "['", "PATH", "\\u", "INFO", "']", " ", "==", " ", "'/", "health", "':", "\\", "10", ";", " ", " ", " ", " ", "response", "\\u", "body", " ", "=", " ", "\"", "1", "\"", "\\", "10", ";", " ", " ", " ", " ", "eli", "f", " ", "environ", "['", "PATH", "\\u", "INFO", "']", " ", "==", " ", "'/", "env", "':", "\\", "10", ";", " ", " ", " ", " ", "response", "\\u", "body", " ", "=", " ", "['", "%", "s", ":", " ", "%", "s", "'", " ", "%", " ", "(", "key", ",", " ", "value", ")", "\\", "10", ";", " ", " ", "for", " ", "key", ",", " ", "value", " ", "in", " ", "sorte", "d", "(", "environ", ".", "items", "())", "]", "\\", "10", ";", " ", " ", " ", " ", "response", "\\u", "body", " ", "=", " ", "'\\\\\\\\", "n", "'.", "join", "(", "response", "\\u", "body", ")", "\\", "10", ";", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", "ctype", " ", "=", " ", "'", "text", "/", "html", "'", "\\", "10", ";", " ", " ", " ", " ", "response", "\\u", "body", " ", "=", " ", "INDE", "X", "\\u", "HTM", "L", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "status", " ", "=", " ", "'", "200", " ", "OK", "'", "\\", "10", ";", " ", " ", " ", " ", "response", "\\u", "header", "s", " ", "=", " ", "[(", "'", "Conten", "t", "-", "Type", "',", " ", "ctype", "),", " ", "('", "Conten", "t", "-", "Length", "',", " ", "str", "(", "len", "(", "response", "\\u", "body", ")))", "]", "\\", "10", ";", " ", " ", " ", " ", "#", "\\", "10", ";", " ", " ", " ", " ", "start", "\\u", "response", "(", "status", ",", " ", "response", "\\u", "header", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "[", "response", "\\u", "body", "]", "\\", "10", ";", "\\", "10", ";", "#", "\\", "10", ";", "#", " ", "Below", " ", "for", " ", "testi", "ng", " ", "only", "\\", "10", ";", "#", "\\", "10", ";", "if", " ", "\\u\\u", "name", "\\u\\u", " ", "==", " ", "'\\u", "\\u", "main", "\\u\\u'", ":", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "wsgi", "ref", ".", "simple", "\\u", "server", " ", "import", " ", "make", "\\u", "server", "\\", "10", ";", " ", " ", " ", " ", "http", "d", " ", "=", " ", "make", "\\u", "server", "('", "local", "host", "',", " ", "805", "1", ",", " ", "applica", "tion", ")", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Wait", " ", "for", " ", "a", " ", "single", " ", "request", ",", " ", "serve", " ", "it", " ", "and", " ", "quit", ".", "\\", "10", ";", " ", " ", " ", " ", "http", "d", ".", "handle", "\\u", "request", "()", "\\", "10", ";'", "''_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "GIT", "CACHE_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/", "rust", "hon", "\\u", "cache", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "##", " ", "this", " ", "hack", " ", "to", " ", "force", " ", "the", " ", "devt", "ool", "s", " ", "window", " ", "to", " ", "show", " ", "first", " ", "will", " ", "not", " ", "work", " ", "bec", "aus", "e", " ", "a", " ", "body", " ", "onl", "oad", " ", "will", " ", "execute_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "at", " ", "the", " ", "same", " ", "time", " ", "and", " ", "the", " ", "js", " ", "debugg", "er", " ", "will", " ", "als", "o", " ", "relo", "ad", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "but", " ", "bec", "aus", "e", " ", "the", " ", "debugg", "er", " ", "is", " ", "in", " ", "anot", "her", " ", "process", ",", " ", "it", " ", "will", " ", "the", " ", "first", " ", "debug", " ", "events", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "NW", "\\u", "DEV", "TOOLS", "\\u", "HA", "CK_", "=_", "'''", "\\", "10", ";<", "html", ">", "\\", "10", ";<", "script", ">", "\\", "10", ";", "require", "('", "nw", ".", "gui", "')", ".", "Window", ".", "get", "()", ".", "show", "Dev", "Tool", "s", "();", "\\", "10", ";", "set", "Time", "out", "(", "function", " ", "()", "{", "\\", "10", ";", "\t", "\t", "//", "require", "('", "nw", ".", "gui", "')", ".", "Window", ".", "get", "()", ".", "relo", "ad", "Dev", "();", "\\", "10", ";", "\t", "\t", "require", "('", "nw", ".", "gui", "')", ".", "Window", ".", "get", "()", ".", "relo", "ad", "();", "\\", "10", ";", "\t", "},", "\\", "10", ";", "\t", "3000", "\\", "10", ";)", ";", "\\", "10", ";<", "/", "script", ">", "\\", "10", ";<", "body", ">", "opening", " ", "devt", "ool", "s", " ", "window", "....", "</", "body", ">", "\\", "10", ";<", "/", "html", ">", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "NW", "\\u", "START", "UP", "\\u", "HA", "CK_", "=_", "'''", "\\", "10", ";", "export", "s", ".", "myi", "nit", " ", "=", " ", "function", "()", " ", "{", "\\", "10", ";", "\t", "require", "('", "nw", ".", "gui", "')", ".", "Window", ".", "get", "()", ".", "show", "Dev", "Tool", "s", "();", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "BOOT", "STRA", "PED", "_", "=_", "None_", "\\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_", "#", "MAIN", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "boots", "trap", "\\u", "rust", "hon", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\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_", "compile", "\\u", "js_", "(_", "script_", ",_", "module", "\\u", "path_", ",_", "main", "\\u", "name_", "=_", "'", "main", "'_", ",_", "direct", "js_", "=_", "False_", ",_", "direct", "loops_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "'''", "\\", "10", ";", "\t", "direct", "js", " ", "=", " ", "Fal", "se", " ", "##", " ", "compatible", " ", "with", " ", "python", "js", "-", "minima", "l", ".", "js", "\\", "10", ";", "\t", "direct", "loop", "s", " ", "=", " ", "Fal", "se", " ", " ", "##", " ", "allow", "s", " ", "for", " ", "looping", " ", "over", " ", "string", "s", ",", " ", "arrays", ",", " ", "hm", "tl", "Element", "s", ",", " ", "etc", ".", " ", "if", " ", "true", " ", "output", "s", " ", "cleaner", " ", "code", ".", "\\", "10", ";", "\t", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fast", "js_", "=_", "True_", "##", " ", "this", " ", "is", " ", "now", " ", "the", " ", "default", ",", " ", "and", " ", "complete", " ", "python", " ", "mode", " ", "is", " ", "deprecated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "script_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "path_", "=_", "module", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fast", "\\u", "javascript", "_", "=_", "fast", "js_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pure", "\\u", "javascript", "_", "=_", "direct", "js_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "pyj", "s_", ",_", "dict_", ")_", ":_", "##", " ", "split", " ", "apart", " ", "by", " ", "web", "workers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "workers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "js_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "js", "file_", "in_", "pyj", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "js_", "=_", "translat", "e\\u", "to", "\\u", "javascript", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pyj", "s_", "[_", "js", "file_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "web", "worker_", "=_", "js", "file_", "==_", "'", "worker", ".", "js", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "require", "js_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "insert", "\\u", "runtime_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fast", "\\u", "javascript", "_", "=_", "fast", "js_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fast", "\\u", "loops_", "=_", "direct", "loops_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "runt", "ime", "\\u", "checks_", "=_", "'--", "release", "'_", "not_", "in_", "sys_", "._", "argv_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "js", "file_", "]_", "=_", "js_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "js", "file_", "==_", "'", "worker", ".", "js", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "workers_", "._", "append_", "(_", "js_", ")_", "\\u\\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_", "main", "js_", "=_", "js", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src_", "=_", "[_", "'", "var", " ", "\\u\\u", "worker", "src", "\\u\\u", " ", "=", " ", "['_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "JS", "\\u", "WEB", "WORKER", "\\u", "HEADER_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "+_", "workers_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "a_", "._", "strip_", "(_", ")_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "src_", "._", "append_", "(_", "'\"", "%", "s", "\\\\\\\\", "n", "\",'_", "%_", "line_", "._", "replace_", "(_", "'\"'_", ",_", "'\\\\\\\\", "\"'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src_", "._", "append_", "(_", "']'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "._", "append_", "(_", "result_", "[_", "main", "js_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "main", "js_", "]_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "src_", ")_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "code_", "=_", "translat", "e\\u", "to", "\\u", "javascript", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pyj", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "as", "\\u", "module_", "=_", "'--", "ES", "6", "-", "module", "'_", "in_", "sys_", "._", "argv_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "require", "js_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "insert", "\\u", "runtime_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fast", "\\u", "javascript", "_", "=_", "fast", "js_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fast", "\\u", "loops_", "=_", "direct", "loops_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "runt", "ime", "\\u", "checks_", "=_", "'--", "release", "'_", "not_", "in_", "sys_", "._", "argv_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "code_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "result_", "._", "update_", "(_", "code_", ")_", "\\u\\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_", "result_", "[_", "'", "main", "'_", "]_", "=_", "code_", "\\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_", "main", "\\u", "name_", "!=_", "'", "main", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "assert", " ", "main", "\\u", "name", ".", "ends", "with", "('.", "js", "')", " ", " ", "##", " ", "allow", " ", "tag", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "result_", "[_", "main", "\\u", "name_", "]_", "=_", "result_", "._", "pop_", "(_", "'", "main", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compile", "\\u", "java_", "(_", "java", "files_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "assert_", "'", "JAVA", "\\u", "HOM", "E", "'_", "in_", "os_", "._", "environ_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpdir_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "'", "java", "c", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "extend_", "(_", "java", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", "'_", "._", "join_", "(_", "cmd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "files_", "=_", "[_", "jf", "ile_", "._", "replace_", "(_", "'.", "java", "'_", ",_", "'.", "class", "'_", ")_", "for_", "jf", "ile_", "in_", "java", "files_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "'", "jar", "'_", ",_", "'", "cv", "f", "'_", ",_", "'", "myb", "uild", ".", "jar", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "extend_", "(_", "class", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", "'_", "._", "join_", "(_", "cmd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jar", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "'", "myb", "uild", ".", "jar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "isfile_", "(_", "jar", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "'", "class", "-", "files", "'_", ":_", "class", "files_", ",_", "'", "jar", "'_", ":_", "jar", "file_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compile", "\\u", "gi", "ws", "\\u", "bindings_", "(_", "xml_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "tmpdir_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "'", "rust", "hon", "\\u", "gi", "ws", ".", "xml", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpfile_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gi", "ws", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "description", "-", "file", "='_", "+_", "tmpfile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "output", "-", "dir", "='_", "+_", "tmpdir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "--", "per", "-", "package", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "disable", "-", "return", "-", "size", "-", "array", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "--", "throw", "s", "-", "exception", "-", "on", "-", "error", "',", " ", "#", " ", "require", "s", " ", "Gi", "ws", "Except", "ion", ".", "hx", "x", " ", "and", " ", "Gi", "ws", "Except", "ion", ".", "cpp_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "subproc", "ess", ".", "check", "\\u", "call", "(", "cmd", ")_", "\\u\\u\\uNL\\u\\u\\u_", "proc_", "=_", "subprocess_", "._", "Popen_", "(_", "cmd_", ",_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "proc_", "._", "returncode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "raise_", "Run", "time", "Error_", "(_", "proc_", "._", "stderr_", "._", "read_", "(_", ")_", ")_", "\\u\\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_", "headers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "impl", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "proc_", "._", "stdout_", "._", "read_", "(_", ")_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "line_", "._", "endswith_", "(_", "'", " ", "generat", "ed", " ", "...'_", ")_", ":_", "##", " ", "TOD", "O", " ", "somet", "hing", " ", "bett", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "name_", "=_", "line_", "._", "split_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "._", "endswith_", "(_", "'.", "hx", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "headers_", "._", "append_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "._", "endswith_", "(_", "'.", "cpp", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "impl", "s_", "._", "append_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "code_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "header_", "in_", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "data_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "header_", ")_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "._", "append_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "impl_", "in_", "impl", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "data_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "impl_", ")_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "'/*", " ", "%", "s", " ", "*/", "'_", "%_", "impl_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "includes_", "=_", "[_", "]_", "##", " ", "ignore", " ", "these", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "data_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "line_", "._", "startswith_", "(_", "'#", "include", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "includes_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "lines_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "code_", "._", "append_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "lines_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'\\\\", "n", "'_", "._", "join_", "(_", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "java", "\\u", "to", "\\u", "rust", "hon", "_", "(_", "input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "j", "2py", "bin_", "=_", "'", "j", "2py", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/", "java", "2py", "tho", "n", "/", "bin", "/", "j", "2py", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "j", "2py", "bin_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/", "java", "2py", "tho", "n", "/", "bin", "/", "j", "2py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'===", "=====", " ", "%", "s", " ", ":", " ", "translat", "e", " ", "to", " ", "rust", "hon", "'_", "%_", "j", "2py", "bin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "2py", "_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "j", "2py", "bin_", ",_", "'--", "rust", "hon", "'_", "]_", ",_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout_", ",_", "stderr_", "=_", "j", "2py", "_", "._", "communicate_", "(_", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stderr_", ":_", "raise_", "Run", "time", "Error_", "(_", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "j", "2py", "_", "._", "returncode_", ":_", "raise_", "Run", "time", "Error_", "(_", "'", "j", "2py", " ", "error", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'-------", "--------------", "------------", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rcode", "_", "=_", "typed", "python_", "._", "transform", "\\u", "source_", "(_", "stdout_", "._", "replace_", "(_", "'", " ", " ", " ", " ", "'_", ",_", "'\\\\", "t", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "rcode", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'-------", "--------------", "------------", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rcode", "_", "\\u\\u\\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", "module_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mark", "down", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cof", "fe", "e", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "python", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rust", "hon", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rust", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "elm", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "c", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "c", "++'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "c", "#'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "go", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "html", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "veri", "log", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bash", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "java", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nim", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xml", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "json", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bazel", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gyp", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rap", "yd", "script", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "javascript", "'_", ":_", "[_", "]_", ",_", "\\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_", "import", "\\u", "md_", "(_", "url_", ",_", "modules_", "=_", "None_", ",_", "index", "\\u", "offset_", "=_", "0_", ",_", "force", "\\u", "tagname_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "assert_", "modules_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code", "\\u", "links_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code", "\\u", "idi", "rs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code", "\\u", "defines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lang_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "code_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "line_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "=_", "force", "\\u", "tagname_", "or_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fence", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "path_", ",_", "mark", "down", "\\u", "name_", "=_", "os_", "._", "path_", "._", "split_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "data", " ", "=", " ", "open", "(", "url", ",", " ", "'", "rb", "')", ".", "read", "()", ".", "decode", "('", "utf", "-", "8", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "codecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "codecs_", "._", "open_", "(_", "url_", ",_", "'", "r", "'_", ",_", "'", "utf", "-", "8", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "data_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "line_", "._", "startswith_", "(_", "'*", " ", "@", "link", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "code", "\\u", "links_", "._", "append_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "line_", "._", "split_", "(_", "':'_", ")_", "[_", "-_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "'*", " ", "@", "include", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "code", "\\u", "idi", "rs_", "._", "append_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "line_", "._", "split_", "(_", "':'_", ")_", "[_", "-_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "'*", " ", "@", "defin", "e", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "code", "\\u", "defines_", "._", "extend_", "(_", "line_", "._", "split_", "(_", "':'_", ")_", "[_", "-_", "1_", "]_", "._", "strip_", "(_", ")_", "._", "split_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Start", " ", "or", " ", "end", " ", "of", " ", "a", " ", "code", " ", "block", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "strip_", "(_", ")_", "._", "startswith_", "(_", "'``", "`'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "fence", "s_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "End", " ", "of", " ", "a", " ", "code", " ", "block", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "in", "\\u", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "lang_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "lang_", "==_", "'", "python", "'_", "and_", "'", "from", " ", "rust", "hon", " ", "import", " ", "*'_", "in_", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "rust", "hon", "py_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rl", "n_", "in_", "open_", "(_", "\\u\\u", "file\\u\\u_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "if_", "rl", "n_", "==_", "'", "if", " ", "\\u\\u", "name", "\\u\\u", " ", "==", " ", "\"\\u\\u", "main", "\\u\\u\"", ":'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "rust", "hon", "py_", "._", "append_", "(_", "rl", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rust", "hon", "py_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "rust", "hon", "py_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utf", "header_", "=_", "u", "'#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "._", "insert_", "(_", "0_", ",_", "utf", "header_", "+_", "BOOT", "STRA", "PED", "_", "+_", "'\\\\", "n", "'_", "+_", "rust", "hon", "py_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "._", "pop_", "(_", "code_", "._", "index_", "(_", "'", "from", " ", "rust", "hon", " ", "import", " ", "*'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", ",_", "n_", "=_", "os_", "._", "path_", "._", "split_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "p_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mark", "down", "'_", ":_", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "'_", ":_", "'\\\\", "n", "'_", "._", "join_", "(_", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "index", "'_", ":_", "index_", "+_", "index", "\\u", "offset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tag", "'_", ":_", "tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "s", "'_", ":_", "code", "\\u", "links_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "include", "-", "dirs", "'_", ":_", "code", "\\u", "idi", "rs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "defin", "es", "'_", ":_", "code", "\\u", "defines_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tag_", "and_", "'.'_", "in_", "tag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "ext_", "=_", "tag_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "1_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "ext", " ", "in", " ", "'", "xml", " ", "html", " ", "js", " ", "css", " ", "py", " ", "c", " ", "cs", " ", "h", " ", "cpp", " ", "hp", "p", " ", "rust", " ", "go", " ", "java", " ", "json", "'.", "split", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "mod_", "[_", "'", "name", "'_", "]_", "=_", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "modules_", "[_", "lang_", "]_", "._", "append_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "\\u", "code_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code", "\\u", "links_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code", "\\u", "idi", "rs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Start", " ", "of", " ", "a", " ", "code", " ", "block", "._", "\\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_", "in", "\\u", "code_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prev", "line_", "and_", "prev", "line_", "._", "strip_", "(_", ")_", "._", "startswith_", "(_", "'@'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "tag_", "=_", "prev", "line_", "._", "strip_", "(_", ")_", "[_", "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\t", "\t\t\t\t_", "tag_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lang_", "=_", "line_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "'``", "`'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "middle", " ", "of", " ", "a", " ", "code", " ", "block", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "in", "\\u", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "code_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "import", " ", "subma", "rk", "down", " ", "file", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "line_", "._", "startswith_", "(_", "'*", " ", "'_", ")_", "and_", "'@", "import", "'_", "in_", "line_", "and_", "line_", "._", "count_", "(_", "'['_", ")_", "==_", "1_", "and_", "line_", "._", "count_", "(_", "']'_", ")_", "==_", "1_", "and_", "line_", "._", "count_", "(_", "'('_", ")_", "==_", "1_", "and_", "line_", "._", "count_", "(_", "')'_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "subma", "rk", "down_", "=_", "line_", "._", "split_", "(_", "'('_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "')'_", ")_", "[_", "0_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subpath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "base", "\\u", "path_", ",_", "subma", "rk", "down_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "subpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "raise_", "Run", "time", "Error_", "(_", "'", "error", ":", " ", "can", " ", "not", " ", "find", " ", "mark", "down", " ", "file", ":", " ", "'_", "+_", "subpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "import", "ing", " ", "subma", "rk", "down", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "subpath_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index_", "+=_", "import", "\\u", "md_", "(_", "subpath_", ",_", "modules_", ",_", "index", "\\u", "offset_", "=_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "doc_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prev", "line_", "=_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "modules_", "[_", "'", "mark", "down", "'_", "]_", "+=_", "'\\\\", "n", "'_", "._", "join_", "(_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fence", "s_", "%_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "raise_", "Syntax", "Error_", "(_", "'", "invalid", " ", "mark", "down", " ", "-", " ", "uncl", "ose", "d", " ", "trip", "ple", " ", "back", " ", "quote", " ", "fence", " ", "in", ":", " ", "%", "s", "'_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "index_", "\\u\\u\\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_", "hack", "\\u", "nim", "\\u", "stdlib", "_", "(_", "code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "'''", "\\", "10", ";", "\t", "alr", "ead", "y", " ", "talk", "ed", " ", "to", " ", "the", " ", "nim", " ", "guy", "s", " ", "in", " ", "irc", ",", " ", "the", "y", " ", "don", "t", " ", "know", " ", "wh", "y", " ", "these", " ", "dl", " ", "function", "s", " ", "need", " ", "to", " ", "be", " ", "strip", "ped", "\\", "10", ";", "\t", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "code_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "'", "dl", "close", "('_", "in_", "line_", "or_", "'", "dlo", "pen", "('_", "in_", "line_", "or_", "'", "dl", "sym", "('_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "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\t", "\t\t_", "out_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'\\\\", "n", "'_", "._", "join_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "restrict", "ed", "\\u", "bash", "_", "(_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "'&", "&'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"`", "\"_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\"'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ok", "cmds_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'./", "configur", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", "'_", ",_", "'", "cma", "ke", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "scons", "'_", ",_", "'", "bazel", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cd", "'_", ",_", "'", "mkd", "ir", "'_", ",_", "'", "cp", "'_", ",_", "#'", "pwd", "',", " ", "'", "ls", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "npm", "'_", ",_", "'", "gru", "nt", "'_", ",_", "'", "gyp", "'_", ",_", "'", "nw", "-", "gyp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "apt", "-", "get", "'_", ",_", "'", "yum", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pip", "'_", ",_", "'", "docker", "'_", ",_", "'", "rh", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "line_", "._", "split_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cmd_", "==_", "'", "sudo", "'_", ":_", "cmd_", "=_", "line_", "._", "split_", "(_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cmd_", "in_", "ok", "cmds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "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\t", "\t_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "build_", "(_", "modules_", ",_", "module", "\\u", "path_", ",_", "datadir", "s_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "'--", "debug", "-", "build", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "raise_", "Run", "time", "Error_", "(_", "modules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "=_", "{_", "'", "execute", "able", "s", "'_", ":_", "[_", "]_", ",_", "'", "rust", "'_", ":_", "[_", "]_", ",_", "'", "c", "'_", ":_", "[_", "]_", ",_", "'", "c", "++'_", ":_", "[_", "]_", ",_", "'", "c", "#'_", ":_", "[_", "]_", ",_", "'", "go", "'_", ":_", "[_", "]_", ",_", "'", "javascript", "'_", ":_", "[_", "]_", ",_", "'", "java", "'_", ":_", "[_", "]_", ",_", "'", "xml", "'_", ":_", "[_", "]_", ",_", "'", "json", "'_", ":_", "[_", "]_", ",_", "'", "python", "'_", ":_", "[_", "]_", ",_", "'", "html", "'_", ":_", "[_", "]_", ",_", "'", "veri", "log", "'_", ":_", "[_", "]_", ",_", "'", "nim", "'_", ":_", "[_", "]_", ",_", "'", "lua", "'_", ":_", "[_", "]_", ",_", "'", "dart", "'_", ":_", "[_", "]_", ",_", "'", "datadir", "s", "'_", ":_", "datadir", "s_", ",_", "'", "datafile", "s", "'_", ":_", "{_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "python", "\\u", "main_", "=_", "{_", "'", "name", "'_", ":_", "'", "main", ".", "py", "'_", ",_", "'", "script", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "go", "\\u", "main_", "=_", "{_", "'", "name", "'_", ":_", "'", "main", ".", "go", "'_", ",_", "'", "source", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagged_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gi", "ws_", "=_", "[_", "]_", "##", " ", "xml", " ", "jn", "i", " ", "generat", "or", " ", "so", " ", "c", "++", " ", "can", " ", "call", " ", "int", "o", " ", "java", ",", " ", "blocks", " ", "tagg", "ed", " ", "with", " ", "@", "gw", "is", " ", "are", " ", "compile", "d", " ", "and", " ", "linked", " ", "with", " ", "the", " ", "final", " ", "exe", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "java", "2r", "ust", "hon", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nim", "\\u", "wrappers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lib", "dl_", "=_", "False_", "##", " ", "provide", "s", ":", " ", "dlo", "pen", ",", " ", "dl", "close", ",", " ", "for", " ", "dynami", "c", " ", "libs", ".", " ", "Ni", "m", " ", "need", "s", " ", "this_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache", "d\\u", "json_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gyp", "\\u", "builds_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "modules_", "[_", "'", "bash", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "bash", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "'", "tag", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "tag_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tag_", "._", "startswith_", "(_", "'", "http", "://'_", ")_", "or_", "tag_", "._", "startswith_", "(_", "'", "https", "://'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "not_", "tag_", "._", "endswith_", "(_", "'.", "git", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "raise_", "Syntax", "Error_", "(_", "'", "only", " ", "git", " ", "repos", " ", "link", "s", " ", "are", " ", "allow", "ed", ":", " ", "'_", "+_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "GIT", "CACHE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "print_", "'", "mak", "ing", " ", "new", " ", "rust", "hon", " ", "cache", " ", "folder", ":", " ", "'_", "+_", "GIT", "CACHE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "GIT", "CACHE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "git", "name_", "=_", "tag_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "[_", ":_", "-_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "GIT", "CACHE_", ",_", "git", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rebuild_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "git", "name_", "not_", "in_", "os_", "._", "listdir_", "(_", "GIT", "CACHE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cmd_", "=_", "[_", "'", "git", "'_", ",_", "'", "clone", "'_", ",_", "tag_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ",_", "cwd_", "=_", "GIT", "CACHE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'--", "git", "-", "sync", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cmd_", "=_", "[_", "'", "git", "'_", ",_", "'", "pull", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ",_", "cwd_", "=_", "project", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "rebuild_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rebuild_", "or_", "'--", "force", "-", "rebu", "ild", "-", "dep", "s", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "print_", "'", "rebu", "ild", "ing", " ", "git", " ", "repo", ":", " ", "'_", "+_", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "TOD", "O", " ", "restrict", " ", "the", " ", "bash", " ", "synta", "x", " ", "allow", "ed", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "or", " ", "build", " ", "it", " ", "in", " ", "a", " ", "sand", "box", " ", "or", " ", "docker", " ", "container", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "mod_", "[_", "'", "code", "'_", "]_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "if_", "not_", "line_", "._", "strip_", "(_", ")_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "is", "\\u", "restrict", "ed", "\\u", "bash", "_", "(_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "raise_", "Syntax", "Error_", "(_", "'", "bash", " ", "build", " ", "script", " ", "synta", "x", " ", "is", " ", "restrict", "ed", ":\\\\", "n", "'_", "+_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "print_", "'>>", "'_", "+_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "line_", "._", "split_", "(_", ")_", ",_", "cwd_", "=_", "project", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "tag_", "]_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "\\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_", "if_", "modules_", "[_", "'", "gyp", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "gyp", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "'", "tag", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "not_", "mod_", "[_", "'", "tag", "'_", "]_", "!=_", "'", "bindi", "ng", ".", "gyp", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "raise_", "Run", "time", "Error_", "(_", "'", "nw", "-", "gyp", " ", "require", "s", " ", "the", " ", "gyp", " ", "file", " ", "is", " ", "named", " ", "`", "bindi", "ng", ".", "gyp", "`'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "'", "bindi", "ng", ".", "gyp", "'_", "]_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gyp", "cfg_", "=_", "json_", "._", "loads_", "(_", "mod_", "[_", "'", "code", "'_", "]_", "._", "replace_", "(_", "\"'\"_", ",_", "'\"'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "len", "(", "gyp", "cfg", "['", "target", "s", "'])", " ", ">", " ", "1", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "gta", "rget", "_", "in_", "gyp", "cfg_", "[_", "'", "target", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "for_", "gs", "rc_", "in_", "gta", "rget", "_", "[_", "'", "source", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "gyp", "\\u", "builds_", "[_", "gs", "rc_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gyp", "'_", ":_", "mod_", "[_", "'", "code", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "src", "'_", ":_", "None_", "\\u\\u\\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_", "if_", "modules_", "[_", "'", "javascript", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "javascript", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "'", "tag", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "tagged_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'.'_", "in_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "\\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_", "modules_", "[_", "'", "json", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "json", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cache", "d\\u", "json_", "[_", "mod_", "[_", "'", "name", "'_", "]_", "]_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "json", "'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "modules_", "[_", "'", "c", "#'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "c", "#'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "output_", "[_", "'", "c", "#'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "modules_", "[_", "'", "elm", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "elm", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "tmp", "elm_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "My", "App", ".", "elm", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "js_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "elm", "-", "output", ".", "js", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmp", "elm_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "elm", "-", "make", "'_", ",_", "tmp", "elm_", ",_", "'--", "output", "'_", ",_", "tmp", "js_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elm", "data_", "=_", "open_", "(_", "tmp", "js_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "elm", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagged_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "elm", "data_", "\\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_", "modules_", "[_", "'", "cof", "fe", "e", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "cof", "fe", "e", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "tmp", "cof", "f_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "temp", ".", "cof", "fe", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "js_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "cof", "fe", "e-", "output", ".", "js", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmp", "cof", "f_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "cof", "fe", "e", "'_", ",_", "'--", "compile", "'_", ",_", "'--", "bare", "'_", ",_", "'--", "output", "'_", ",_", "tmp", "js_", ",_", "tmp", "cof", "f_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cof", "fdata", "_", "=_", "open_", "(_", "tmp", "js_", "+_", "'/", "temp", ".", "js", "'_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "cof", "fdata", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagged_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "cof", "fdata", "_", "\\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_", "modules_", "[_", "'", "rap", "yd", "script", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "rap", "yd", "script", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "tmp", "rap", "yd", "_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "temp", ".", "rap", "yd", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "js_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rap", "yd", "-", "output", ".", "js", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmp", "rap", "yd", "_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "mod_", "[_", "'", "code", "'_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "rap", "yd", "script", "'_", ",_", "tmp", "rap", "yd", "_", ",_", "'--", "bare", "'_", ",_", "'--", "output", "'_", ",_", "tmp", "js_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rap", "ydata_", "=_", "open_", "(_", "tmp", "js_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "rap", "ydata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagged_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "rap", "ydata_", "\\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_", "modules_", "[_", "'", "nim", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "lib", "dl_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "if", " ", "compile", "\\u", "nim", "\\u", "lib", " ", "is", " ", "Fal", "se", " ", "then", " ", "use", " ", "old", " ", "hack", " ", "to", " ", "compile", " ", "nim", " ", "source", " ", "by", " ", "extracti", "ng", " ", "it", " ", "and", " ", "forcing", " ", "int", "o", " ", "a", " ", "single", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "compile", "\\u", "nim", "\\u", "lib_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nim", "bin_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/", "Ni", "m", "/", "bin", "/", "nim", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nim", "include_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/", "Ni", "m", "/", "lib", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "nim", "bin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "nim", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "##", " ", "save", " ", "standalone", " ", "nim", " ", "program", ",", " ", "can", " ", "be", " ", "run", " ", "with", " ", "`", "rust", "hon", ".", "py", " ", "my", ".", "md", " ", "--", "run", "=", "myapp", ".", "nim", "`_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "output_", "[_", "'", "nim", "'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "##", " ", "use", " ", "nim", " ", "to", " ", "translat", "e", " ", "to", " ", "C", " ", "and", " ", "build", " ", "late", "r", " ", "as", " ", "static", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "tmpfile_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "\\u", "build", ".", "nim", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nim", "src_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "._", "replace_", "(_", "'\\\\", "t", "'_", ",_", "'", " ", " ", "'_", ")_", "##", " ", "nim", " ", "will", " ", "not", " ", "accept", " ", "tabs", ",", " ", "replace", " ", "with", " ", "two", " ", "space", "s", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gen", "\\u", "nim", "\\u", "wrappers_", "(_", "nim", "src_", ",_", "nim", "\\u", "wrappers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpfile_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "nim", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "compile", "\\u", "nim", "\\u", "lib_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "lets", " ", "nim", " ", "compile", " ", "the", " ", "library_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", " ", "=", " ", "[", "nim", "bin", ",", " ", "'", "compile", "',", " ", "'--", "app", ":", "static", "Lib", "',", " ", "'--", "no", "Main", "',", " ", "'--", "header", "']", " ", " ", "##", " ", "static", "lib", " ", "has", " ", "problem", "s", " ", "linking", " ", "with", " ", "dlo", "pen", ",", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cmd_", "=_", "[_", "nim", "bin_", ",_", "'", "compile", "'_", ",_", "'--", "app", ":", "lib", "'_", ",_", "'--", "no", "Main", "'_", ",_", "'--", "header", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cmd_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "nim", "bin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compile", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "header", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "no", "Main", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "no", "Link", "ing", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "compile", "On", "ly", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "gen", "Script", "'_", ",_", "##", " ", "broken", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "app", ":", "static", "Lib", "'_", ",_", "##", " ", "Ara", "q", " ", "say", "s", " ", "static", "lib", " ", "and", " ", "no", "Main", " ", "will", " ", "not", " ", "work", " ", "tog", "ether", "._", "\\u\\u\\uNL\\u\\u\\u_", "'--", "dead", "Code", "Eli", "m", ":", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "import", " ", "thread", "pool", "'_", "in_", "nim", "src_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cmd_", "._", "append_", "(_", "'--", "thread", "s", ":", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "._", "append_", "(_", "'", "rust", "hon", "\\u", "build", ".", "nim", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'-------", "-", " ", "compile", " ", "nim", " ", "program", " ", "-----------", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", "'_", "._", "join_", "(_", "cmd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ",_", "cwd_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "compile", "\\u", "nim", "\\u", "lib_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "static", "lib", " ", "broken", " ", "in", " ", "nim", "?", " ", "missi", "ng", " ", "dlo", "pen_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "libname", "_", "=_", "'", "rust", "hon", "\\u", "build", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "._", "append_", "(_", "libname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "output", "['", "c", "']", ".", "append", "({", "'", "source", "':", "mod", "['", "code", "']", ",", " ", "'", "static", "lib", "':", "libname", "+'", ".", "a", "'})", "_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "[_", "'", "c", "'_", "]_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "source", "'_", ":_", "mod_", "[_", "'", "code", "'_", "]_", ",_", "'", "dynami", "clib", "'_", ":_", "libname", "_", "+_", "'.", "so", "'_", ",_", "'", "name", "'_", ":_", "'", "lib", "%", "s", ".", "so", "'_", "%_", "libname", "_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "get", " ", "source", " ", "from", " ", "nim", " ", "cache", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "nim", "cache_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tempfile_", "._", "gettempdir_", "(_", ")_", ",_", "'", "nim", "cache", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nim", "\\u", "stdlib", "_", "=_", "hack", "\\u", "nim", "\\u", "stdlib", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "nim", "cache_", ",_", "'", "stdlib", "\\u", "system", ".", "c", "'_", ")_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "nim", "\\u", "header", " ", "=", " ", "open", "(", "os", ".", "path", ".", "join", "(", "nim", "cache", ",'", "rust", "hon", "\\u", "build", ".", "h", "')", ",", " ", "'", "rb", "')", ".", "read", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "nim", "\\u", "code_", "=_", "hack", "\\u", "nim", "\\u", "code_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "nim", "cache_", ",_", "'", "rust", "hon", "\\u", "build", ".", "c", "'_", ")_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "gets", " ", "compile", "d", " ", "below_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dynami", "c", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "-", "dirs", "'_", ":_", "[_", "nim", "cache_", ",_", "nim", "include_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "build", "-", "dirs", "':", "[", "nim", "cache", "],", " ", " ", "##", " ", "not", " ", "working", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "index", "'_", ":_", "mod_", "[_", "'", "index", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "'_", ":_", "'\\\\", "n", "'_", "._", "join_", "(_", "[_", "nim", "\\u", "stdlib", "_", ",_", "nim", "\\u", "code_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "code", "'", " ", ":", " ", "header_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modules_", "[_", "'", "c", "'_", "]_", "._", "append_", "(_", "cfg_", ")_", "\\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\t", "\t\t_", "print_", "(_", "'", "WARN", "ING", ":", " ", "can", " ", "not", " ", "find", " ", "nim", " ", "compiler", "'_", ")_", "\\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_", "modules_", "[_", "'", "java", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "java", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "java", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpdir_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", "==_", "'", "java", "2r", "ust", "hon", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "rcode", "_", "=_", "java", "\\u", "to", "\\u", "rust", "hon", "_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "java", "2r", "ust", "hon", "_", "._", "append_", "(_", "rcode", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "name", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "jp", "ath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "mod_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'/'_", "in_", "mod_", "[_", "'", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "jd", "ir_", ",_", "jn", "ame_", "=_", "os_", "._", "path_", "._", "split_", "(_", "jp", "ath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "jd", "ir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "os_", "._", "makedirs_", "(_", "jd", "ir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "open_", "(_", "jp", "ath_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "java", "files_", "._", "append_", "(_", "jp", "ath_", ")_", "\\u\\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_", "raise_", "Syntax", "Error_", "(_", "'", "java", " ", "code", " ", "must", " ", "have", " ", "a", " ", "tag", " ", "header", ":", " ", "`", "java", "2r", "ust", "hon", "`", " ", "or", " ", "a", " ", "file", " ", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "java", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "output_", "[_", "'", "java", "'_", "]_", "._", "append_", "(_", "compile", "\\u", "java_", "(_", "java", "files_", ")_", ")_", "\\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_", "modules_", "[_", "'", "xml", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "xml", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", "==_", "'", "gw", "is", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "gi", "ws_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "##", " ", "hand", " ", "writt", "en", " ", "bindi", "ngs", " ", "shou", "ld", " ", "get", " ", "saved", " ", "in", " ", "output", " ", "tar", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bindings_", "=_", "compile", "\\u", "gi", "ws", "\\u", "bindings_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modules_", "[_", "'", "c", "++'_", "]_", "._", "append_", "(_", "{_", "'", "code", "'_", ":_", "bindings_", ",_", "'", "index", "'_", ":_", "mod_", "[_", "'", "index", "'_", "]_", "}_", ")_", "##", " ", "gets", " ", "compile", "d", " ", "below_", "\\u\\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_", "output_", "[_", "'", "xml", "'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "js", "\\u", "merge_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpp", "\\u", "merge_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpp", "\\u", "links_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpp", "\\u", "idi", "rs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpp", "\\u", "defines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compile", "\\u", "mode_", "=_", "'", "binar", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exe", "name_", "=_", "'", "rust", "hon", "-", "test", "-", "bin", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagg", "ed", "\\u", "trans", "\\u", "src_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "modules_", "[_", "'", "rust", "hon", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "rust", "hon", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "script_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "=_", "script_", "._", "splitlines_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "=_", "'", "c", "++'_", "##", " ", "default", " ", "to", " ", "c", "++", " ", "backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "header_", "._", "startswith_", "(_", "'#", "back", "end", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "backend_", "=_", "header_", "._", "split_", "(_", "':'_", ")_", "[_", "-_", "1_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", " ", "'_", "in_", "backend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "backend_", ",_", "compile", "\\u", "mode_", "=_", "backend_", "._", "split_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\\\\", "t", "'_", "in_", "backend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "backend_", ",_", "compile", "\\u", "mode_", "=_", "backend_", "._", "split_", "(_", "'\\\\", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "backend_", "not_", "in_", "'", "c", "++", " ", "rust", " ", "javascript", " ", "go", " ", "veri", "log", " ", "dart", " ", "lua", "'_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "raise_", "Syntax", "Error_", "(_", "'", "invalid", " ", "back", "end", ":", " ", "%", "s", "'_", "%_", "backend_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "compile", "\\u", "mode_", "and_", "compile", "\\u", "mode_", "not_", "in_", "'", "binar", "y", " ", "static", "lib", " ", "dynami", "clib", "'_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "raise_", "Syntax", "Error_", "(_", "'", "invalid", " ", "back", "end", " ", "option", " ", "<", "%", "s", ">", " ", "(", "valid", " ", "types", ":", " ", "binar", "y", ",", " ", "static", "lib", ",", " ", "dynami", "clib", ")'_", "%_", "backend_", ")_", "\\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_", "backend_", "==_", "'", "veri", "log", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "vco", "de_", "=_", "translat", "e\\u", "to", "\\u", "veri", "log_", "(_", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modules_", "[_", "'", "veri", "log", "'_", "]_", "._", "append_", "(_", "{_", "'", "code", "'_", ":_", "vco", "de_", ",_", "'", "index", "'_", ":_", "index_", "}_", ")_", "##", " ", "gets", " ", "compile", "d", " ", "below_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "backend_", "==_", "'", "c", "++'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", "and_", "mod_", "[_", "'", "tag", "'_", "]_", "and_", "'.'_", "not_", "in_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "exe", "name_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "user", " ", "named", " ", "output", " ", "for", " ", "external", " ", "build", " ", "tool", "s", " ", "tha", "t", " ", "need", " ", ".", "h", ",.", "hp", "p", ",.", "cpp", ",", " ", "files", " ", "output", " ", "to", " ", "hard", "code", "d", " ", "path", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", "and_", "(_", "mod_", "[_", "'", "tag", "'_", "]_", "._", "endswith_", "(_", "'.", "h", "'_", ")_", "or_", "mod_", "[_", "'", "tag", "'_", "]_", "._", "endswith_", "(_", "'.", "hp", "p", "'_", ")_", "or_", "mod_", "[_", "'", "tag", "'_", "]_", "._", "endswith_", "(_", "'.", "cpp", "'_", ")_", "or_", "mod_", "[_", "'", "tag", "'_", "]_", "._", "endswith_", "(_", "'.", "cc", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "script_", ",_", "cpp_", "=_", "True_", ",_", "module", "\\u", "path_", "=_", "module", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "try_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'--", "no", "-", "except", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "use", "\\u", "try_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mod_", "[_", "'", "tag", "'_", "]_", "in_", "gyp", "\\u", "builds_", "._", "keys_", "(_", ")_", ":_", "##", " ", "nw", "-", "gyp", " ", "builds", " ", "with", "out", " ", "c", "++", " ", "exceptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "use", "\\u", "try_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pak", "_", "=_", "translat", "e\\u", "to", "\\u", "cpp_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pyj", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "d\\u", "json", "\\u", "files_", "=_", "cache", "d\\u", "json_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "insert", "\\u", "runtime_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "in_", "gyp", "\\u", "builds_", "._", "keys_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "try_", "=_", "use", "\\u", "try_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'--", "debug", "-", "c", "++'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "raise_", "Run", "time", "Error_", "(_", "pak", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "pak", " ", "contain", "s", ":", " ", "c\\u", "header", " ", "and", " ", "cpp", "\\u", "header_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "pak", "_", "[_", "'", "main", "'_", "]_", "##", " ", "save", " ", "to", " ", "output", " ", "c", "++", " ", "to", " ", "tar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", "in_", "gyp", "\\u", "builds_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "gyp", "\\u", "builds_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "[_", "'", "src", "'_", "]_", "=_", "pak", "_", "[_", "'", "main", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "user", "-", "header", "s", "'_", "in_", "pak", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "for_", "class", "tag_", "in_", "pak", "_", "[_", "'", "user", "-", "header", "s", "'_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "class", "header_", "=_", "pak", "_", "[_", "'", "user", "-", "header", "s", "'_", "]_", "[_", "class", "tag_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header", "file_", "=_", "class", "header_", "[_", "'", "file", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "header", "file_", "in_", "output_", "[_", "'", "datafile", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "header", "file_", "]_", "+=_", "'\\\\", "n", "'_", "+_", "'\\\\", "n", "'_", "._", "join_", "(_", "class", "header_", "[_", "'", "source", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "header", "file_", "]_", "=_", "'\\\\", "n", "'_", "+_", "'\\\\", "n", "'_", "._", "join_", "(_", "class", "header_", "[_", "'", "source", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "cpp", "\\u", "merge_", "._", "append_", "(_", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "link", "s", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cpp", "\\u", "links_", "._", "extend_", "(_", "mod_", "[_", "'", "link", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "include", "-", "dirs", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cpp", "\\u", "idi", "rs_", "._", "extend_", "(_", "mod_", "[_", "'", "include", "-", "dirs", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "defin", "es", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cpp", "\\u", "defines_", "._", "extend_", "(_", "mod_", "[_", "'", "defin", "es", "'_", "]_", ")_", "\\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_", "backend_", "==_", "'", "rust", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "script_", ",_", "rust", "_", "=_", "True_", ",_", "module", "\\u", "path_", "=_", "module", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rust", "code_", "=_", "translat", "e\\u", "to", "\\u", "rust", "_", "(_", "pyj", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modules_", "[_", "'", "rust", "'_", "]_", "._", "append_", "(_", "{_", "'", "code", "'_", ":_", "rust", "code_", ",_", "'", "index", "'_", ":_", "index_", "}_", ")_", "##", " ", "gets", " ", "compile", "d", " ", "below_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "backend_", "==_", "'", "go", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "script_", ",_", "go_", "=_", "True_", ",_", "module", "\\u", "path_", "=_", "module", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "go", "code_", "=_", "translat", "e\\u", "to", "\\u", "go_", "(_", "pyj", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "module", "s", "['", "go", "']", ".", "append", "(", " ", "{", "'", "code", "':", "go", "code", "})", " ", " ", "##", " ", "gets", " ", "compile", "d", " ", "below_", "\\u\\u\\uNL\\u\\u\\u_", "go", "\\u", "main_", "[_", "'", "source", "'_", "]_", "._", "append_", "(_", "go", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "backend_", "==_", "'", "javascript", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", "and_", "mod_", "[_", "'", "tag", "'_", "]_", "._", "endswith_", "(_", "'.", "js", "'_", ")_", ":_", "##", " ", "save", "s", " ", "to", " ", "external", " ", "js", " ", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "js_", "=_", "compile", "\\u", "js_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ",_", "module", "\\u", "path_", ",_", "main", "\\u", "name_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "[_", "'", "build", "'_", "]_", "=_", "{_", "'", "script", "'_", ":_", "js_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagged_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "js_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagg", "ed", "\\u", "trans", "\\u", "src_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "##", " ", "so", " ", "user", " ", "can", " ", "embed", " ", "original", " ", "source", " ", "usi", "ng", " ", "<!", "tagname", ">_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "js_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "output_", "[_", "'", "javascript", "'_", "]_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "name_", ",_", "'", "script", "'_", ":_", "js_", "[_", "name_", "]_", ",_", "'", "index", "'_", ":_", "index_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "js", "\\u", "merge_", "._", "append_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "backend_", "==_", "'", "lua", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "script_", ",_", "lua", "_", "=_", "True_", ",_", "module", "\\u", "path_", "=_", "module", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lua", "code_", "=_", "translat", "e\\u", "to", "\\u", "lua", "_", "(_", "pyj", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "main", ".", "lua", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "name_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "name_", "._", "endswith_", "(_", "'.", "lua", "'_", ")_", ":_", "name_", "+=_", "'.", "lua", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "lua", "'_", "]_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "name_", ",_", "'", "script", "'_", ":_", "lua", "code_", ",_", "'", "index", "'_", ":_", "index_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "backend_", "==_", "'", "dart", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "script_", ",_", "dart", "_", "=_", "True_", ",_", "module", "\\u", "path_", "=_", "module", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dart", "code_", "=_", "translat", "e\\u", "to", "\\u", "dart", "_", "(_", "pyj", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "main", ".", "dart", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "name_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "name_", "._", "endswith_", "(_", "'.", "dart", "'_", ")_", ":_", "name_", "+=_", "'.", "dart", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "dart", "'_", "]_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "name_", ",_", "'", "script", "'_", ":_", "dart", "code_", ",_", "'", "index", "'_", ":_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "js", "\\u", "merge_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "tagg", "roup", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "js", "\\u", "merge_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "tagname_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tagname_", "not_", "in_", "tagg", "roup", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "tagg", "roup", "s_", "[_", "tagname_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src_", "=_", "tagg", "roup", "s_", "[_", "tagname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "tagname_", "in_", "tagg", "roup", "s_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "group", "src_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "tagg", "roup", "s_", "[_", "tagname_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "js_", "=_", "compile", "\\u", "js_", "(_", "group", "src_", ",_", "module", "\\u", "path_", ",_", "main", "\\u", "name_", "=_", "tagname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagged_", "[_", "tagname_", "]_", "=_", "js_", "[_", "tagname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagg", "ed", "\\u", "trans", "\\u", "src_", "[_", "tagname_", "]_", "=_", "group", "src_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "js_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "output_", "[_", "'", "javascript", "'_", "]_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "name_", ",_", "'", "script", "'_", ":_", "js_", "[_", "name_", "]_", ",_", "'", "index", "'_", ":_", "index_", "}_", ")_", "\\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_", "cpy", "embed_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nu", "itk", "a_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nu", "itk", "a", "\\u", "include", "\\u", "path_", "=_", "None_", "##", " ", "TOD", "O", " ", "option", " ", "for", " ", "this_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nu", "itk", "a", "\\u", "module", "\\u", "name_", "=_", "'", "unn", "ame", "d\\u", "nu", "itk", "a", "\\u", "module", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "modules_", "[_", "'", "python", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "python", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "name_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "==_", "'", "nu", "itk", "a", "'_", "or_", "name_", "._", "startswith_", "(_", "'", "nu", "itk", "a", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "':'_", "in_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "nu", "itk", "a", "\\u", "module", "\\u", "name_", "=_", "name_", "._", "split_", "(_", "':'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "len_", "(_", "nu", "itk", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\u\\u", "file", "\\u\\u", " ", "is", " ", "undefined", " ", "whe", "n", " ", "CP", "yth", "on", " ", "is", " ", "embedde", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cpy", "embed", ".", "append", "('", "sys", ".", "path", ".", "append", "(", "os", ".", "path", ".", "dir", "name", "(\\u", "\\u", "file", "\\u\\u)", ")'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cpy", "embed", ".", "append", "('", "print", " ", "sys", ".", "argv", "')", " ", " ", "##", " ", "als", "o", " ", "undefined", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cpy", "embed_", "._", "append_", "(_", "'", "import", " ", "sys", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpy", "embed_", "._", "append_", "(_", "'", "sys", ".", "path", ".", "append", "(\".", "/\"", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpy", "embed_", "._", "append_", "(_", "'", "from", " ", "%", "s", " ", "import", " ", "*'_", "%_", "nu", "itk", "a", "\\u", "module", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nu", "itk", "a_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "==_", "'", "embed", "'_", "or_", "name_", "==_", "'", "embed", ":", "cpy", "tho", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "cpy", "embed_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\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_", "if_", "not_", "name_", "._", "endswith_", "(_", "'.", "py", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "name_", "+=_", "'.", "py", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "[_", "'", "python", "'_", "]_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "name_", ",_", "'", "script", "'_", ":_", "mod_", "[_", "'", "code", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "len_", "(_", "output_", "[_", "'", "python", "'_", "]_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "python", "\\u", "main_", "[_", "'", "script", "'_", "]_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\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_", "output_", "[_", "'", "python", "'_", "]_", "[_", "-_", "1_", "]_", "[_", "'", "script", "'_", "]_", "+=_", "'\\\\", "n", "'_", "+_", "mod_", "[_", "'", "code", "'_", "]_", "\\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_", "if_", "cpp", "\\u", "merge_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "merge_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nu", "itk", "a", "\\u", "funcs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "java", "2r", "ust", "hon", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "merge_", "._", "extend_", "(_", "java", "2r", "ust", "hon", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "java", "2r", "ust", "hon", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "nim", "\\u", "wrappers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "inserts", " ", "generat", "ed", " ", "rust", "hon", " ", "nim", " ", "wrapp", "ers", " ", "int", "o", " ", "script", " ", "bef", "ore", " ", "translatio", "n", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "nim", "\\u", "wrappers_", "._", "insert_", "(_", "0_", ",_", "'#", " ", "nim", " ", "wrapp", "ers", " ", "generat", "ed", " ", "by", " ", "rust", "hon", " ", "#'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nim", "\\u", "wrappers_", "._", "insert_", "(_", "1_", ",_", "'", "with", " ", "extern", "(", "abi", "=\"", "C", "\"):", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge_", "._", "extend_", "(_", "nim", "\\u", "wrappers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "nu", "itk", "a_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "npa", "k", " ", "=", " ", "nu", "itk", "a", "\\u", "compile", "\\u", "integrated", "('\\", "\\", "n", "'.", "join", "(", "nu", "itk", "a", "),", " ", "nu", "itk", "a", "\\u", "funcs", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "h", " ", "in", " ", "npa", "k", "['", "files", "']", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "module", "s", "['", "c", "++", "']", ".", "append", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "{", "'", "code", "':", "h", "['", "data", "']", ",", " ", "'", "tag", "':", "h", "['", "name", "']", ",", " ", "'", "index", "':", "0", "}_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ns", "rc_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "nu", "itk", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "c", "++'_", "]_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "static", "lib", "'_", ":_", "nu", "itk", "a", "\\u", "compile_", "(_", "ns", "rc_", ",_", "nu", "itk", "a", "\\u", "module", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "-", "name", "'_", ":_", "'", "my", "\\u", "nu", "itk", "a", "\\u", "module", ".", "py", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "my", "\\u", "nu", "itk", "a", "\\u", "module", ".", "so", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ":_", "ns", "rc_", ",_", "\\u\\u\\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_", "merge_", "._", "extend_", "(_", "cpp", "\\u", "merge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "merge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "script_", ",_", "cpp_", "=_", "True_", ",_", "module", "\\u", "path_", "=_", "module", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pak", "_", "=_", "translat", "e\\u", "to", "\\u", "cpp_", "(_", "pyj", "s_", ",_", "cache", "d\\u", "json", "\\u", "files_", "=_", "cache", "d\\u", "json_", ")_", "##", " ", "pak", " ", "contain", "s", ":", " ", "c\\u", "header", " ", "and", " ", "cpp", "\\u", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "len_", "(_", "modules_", "[_", "'", "c", "++'_", "]_", ")_", "+_", "len_", "(_", "gi", "ws_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpp", "code_", "=_", "pak", "_", "[_", "'", "main", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "nu", "itk", "a", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "cpp", "code", " ", "=", " ", "npa", "k", "['", "main", "']", " ", "+", " ", "'\\\\", "n", "'", " ", "+", " ", "cpp", "code_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cpy", "embed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "inline", "py_", "=_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "cpy", "embed_", ")_", ")_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "'\\\\\\\\", "n", "'_", ")_", "._", "replace_", "(_", "'\"'_", ",_", "'\\\\\\\\", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "static", "str_", "=_", "'", "const", " ", "char", "*", " ", "\\u\\u", "python", "\\u", "main", "\\u", "script", "\\u\\u", " ", "=", " ", "\"%", "s", "\";", "\\\\", "n", "'_", "%_", "inline", "py_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpp", "code_", "=_", "static", "str_", "+_", "cpp", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "modules_", "[_", "'", "c", "++'_", "]_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "code", "'_", ":_", "cpp", "code_", ",_", "'", "index", "'_", ":_", "n_", "+_", "1_", ",_", "'", "link", "s", "'_", ":_", "cpp", "\\u", "links_", ",_", "'", "include", "-", "dirs", "'_", ":_", "cpp", "\\u", "idi", "rs_", ",_", "'", "defin", "es", "'_", ":_", "cpp", "\\u", "defines_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "##", " ", "gets", " ", "compile", "d", " ", "below_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "HTM", "L", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "modules_", "[_", "'", "html", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "html", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "html_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "mod_", "[_", "'", "code", "'_", "]_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "`~", "/", "some", "/", "path", "/", "mys", "cript", ".", "js", "`", " ", "special", " ", "synta", "x", " ", "to", " ", "copy", " ", "javascript", " ", "direct", "ly", " ", "int", "o", " ", "the", " ", "output", " ", "html", ",", " ", "good", " ", "for", " ", "testi", "ng", " ", "local", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "line_", "._", "strip_", "(_", ")_", "._", "startswith_", "(_", "'<", "script", " ", "'_", ")_", "and_", "line_", "._", "strip_", "(_", ")_", "._", "endswith_", "(_", "'<", "/", "script", ">'_", ")_", "and_", "'", "src", "=\"", "~", "/'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "url_", "=_", "line_", "._", "split_", "(_", "'", "src", "=\"'_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "'\"'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "html_", "._", "append_", "(_", "'<", "script", " ", "type", "=\"", "text", "/", "javascript", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "open_", "(_", "url_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "/", "script", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "git", "=\"'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "git", "url_", "=_", "line_", "._", "split_", "(_", "'", "git", "=\"'_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "'\"'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "download", "ing", " ", "librar", "y", "->", " ", "'_", "+_", "git", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "'", "git", "'_", ",_", "'", "clone", "'_", ",_", "git", "url_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ",_", "cwd_", "=_", "os_", "._", "environ_", "[_", "'", "HOM", "E", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "isfile_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "script", " ", "type", "=\"", "text", "/", "javascript", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "open_", "(_", "url_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "/", "script", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "source", "=\"'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "src", "url_", "=_", "line_", "._", "split_", "(_", "'", "source", "=\"'_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "'\"'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "download", "ing", " ", "javascript", "->", " ", "'_", "+_", "src", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src", "data_", "=_", "urllib_", "._", "urlopen_", "(_", "src", "url_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srcp", "ath_", "=_", "os_", "._", "path_", "._", "split_", "(_", "url_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "srcp", "ath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "os_", "._", "makedirs_", "(_", "srcp", "ath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "open_", "(_", "url_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "src", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "isfile_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "script", " ", "type", "=\"", "text", "/", "javascript", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "open_", "(_", "url_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "/", "script", ">'_", ")_", "\\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_", "print_", "(_", "'", "ERROR", ":", " ", "coul", "d", " ", "not", " ", "find", " ", "file", " ", "to", " ", "inline", ":", " ", "%", "s", "'_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "strip_", "(_", ")_", "._", "startswith_", "(_", "'<", "link", " ", "'_", ")_", "and_", "(_", "'", "href", "=\"", "~", "/'_", "in_", "line_", "or_", "\"", "href", "='", "~", "/\"_", "in_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "zip", "url_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "zip", "=\"'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "zip", "url_", "=_", "line_", "._", "split_", "(_", "'", "zip", "=\"'_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "'\"'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "href", "=\"'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "url_", "=_", "line_", "._", "split_", "(_", "'", "href", "=\"'_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "'\"'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "url_", "=_", "line_", "._", "split_", "(_", "\"", "href", "='\"_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "\"'\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "html_", "._", "append_", "(_", "'<", "style", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "open_", "(_", "url_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "/", "style", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "zip", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "download", "ing", " ", "css", " ", "librar", "y", "->", "'_", "+_", "zip", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zip", "data_", "=_", "urllib_", "._", "urlopen_", "(_", "zip", "url_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "'/", "tmp", "/", "css", "lib", ".", "zip", "'_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "zip", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "unzip", "'_", ",_", "'/", "tmp", "/", "css", "lib", ".", "zip", "'_", "]_", ",_", "cwd_", "=_", "os_", "._", "environ_", "[_", "'", "HOM", "E", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "style", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "open_", "(_", "url_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "/", "style", ">'_", ")_", "\\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_", "print_", "(_", "'", "ERROR", ":", " ", "coul", "d", " ", "not", " ", "find", " ", "css", " ", "file", " ", "to", " ", "inline", ":", " ", "%", "s", "'_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "html_", "._", "append_", "(_", "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_", "html_", "=_", "unicode_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "html_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "tagname_", "in_", "tagged_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "tag_", "=_", "u", "'<", "@", "%", "s", ">'_", "%_", "tagname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "js_", "=_", "tagged_", "[_", "tagname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tag_", "in_", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "TOD", "O", " ", "fix", " ", "this", " ", "ug", "ly", " ", "mess_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "javascript", " ", "with", " ", "unicode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "xxx", "_", "=_", "u", "'<", "script", " ", "type", "=\"", "text", "/", "javascript", "\"", " ", "id", "=\"", "%", "s", "\\u", "transp", "ile", "d", "\">", "\\\\", "n", "%", "s", "</", "script", ">'_", "%_", "(_", "tagname_", ",_", "js_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Decode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "rust", "hon", " ", "translat", "ed", " ", "to", " ", "js_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "xxx", "_", "=_", "u", "'<", "script", " ", "type", "=\"", "text", "/", "javascript", "\"", " ", "id", "=\"", "%", "s", "\\u", "transp", "ile", "d", "\">", "\\\\", "n", "%", "s", "</", "script", ">'_", "%_", "(_", "tagname_", ",_", "js_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html_", "=_", "html_", "._", "replace_", "(_", "tag_", ",_", "xxx", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tagname_", "in_", "tagg", "ed", "\\u", "trans", "\\u", "src_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "stag", "_", "=_", "u", "'<!", "%", "s", ">'_", "%_", "tagname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "py_", "=_", "tagg", "ed", "\\u", "trans", "\\u", "src_", "[_", "tagname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stag", "_", "in_", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "TOD", "O", " ", "fix", " ", "this", " ", "ug", "ly", " ", "mess_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "xxx", "_", "=_", "u", "'<", "script", " ", "type", "=\"", "text", "/", "rust", "hon", "\"", " ", "id", "=\"", "%", "s", "\">", "\\\\", "n", "%", "s", "</", "script", ">'_", "%_", "(_", "tagname_", ",_", "py_", ")_", "\\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\t", "\t\t\t\t\t\t_", "xxx", "_", "=_", "u", "'<", "script", " ", "type", "=\"", "text", "/", "rust", "hon", "\"", " ", "id", "=\"", "%", "s", "\">", "\\\\", "n", "%", "s", "</", "script", ">'_", "%_", "(_", "tagname_", ",_", "py_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html_", "=_", "html_", "._", "replace_", "(_", "stag", "_", ",_", "xxx", "_", ")_", "\\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_", "mod_", "[_", "'", "code", "'_", "]_", "=_", "html_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "html", "'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "inline", "s", " ", "js", " ", "app", " ", "int", "o", " ", "opens", "hift", " ", "default", " ", "style", " ", "python", " ", "server", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'--", "opens", "hift", "-", "python", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bco", "ded", "_", "=_", "base64_", "._", "b64encode_", "(_", "mod_", "[_", "'", "code", "'_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wsgi_", "=_", "[_", "OPENS", "HIFT", "\\u", "PY", "_", "[_", "0_", "]_", "%_", "bco", "ded", "_", ",_", "OPENS", "HIFT", "\\u", "PY", "_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "'", "wsgi", ".", "py", "'_", "]_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "wsgi_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\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_", "modules_", "[_", "'", "veri", "log", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "source_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "mod_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "veri", "log", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "source_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "name", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "name", "'_", "]_", "==_", "'", "main", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "main", "mod_", "=_", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "main", "mod_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "main", "mod_", "=_", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mod_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "veri", "log", "'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "usr", "/", "bin", "/", "iver", "ilo", "g", "'_", ")_", "or_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "usr", "/", "local", "/", "bin", "/", "iver", "ilo", "g", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mod_", "[_", "'", "source", "'_", "]_", "=_", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "[_", "'", "binar", "y", "'_", "]_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "sv", "-", "build", ".", "vv", "p", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "[_", "'", "name", "'_", "]_", "=_", "'", "main", ".", "vv", "p", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "execute", "able", "s", "'_", "]_", "._", "append_", "(_", "mod_", "[_", "'", "binar", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpfile_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "veri", "log", "-", "build", ".", "sv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpfile_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "note", ":", " ", "iver", "ilo", "g", " ", "default", "s", " ", "to", " ", "veri", "log", " ", "mode", ",", " ", "not", " ", "system", "veri", "log", ",", " ", "`-", "g2", "005", "-", "sv", "`", " ", "is", " ", "require", "d", ".", " ", "'-", "g2", "012", "'", " ", "als", "o", " ", "works", "._", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "iver", "ilo", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "g2", "005", "-", "sv", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rust", "hon", "-", "sv", "-", "build", ".", "vv", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "cmd_", ",_", "cwd_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "._", "returncode_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "src", "lines_", "=_", "source_", "._", "splitlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "p_", "._", "stderr_", "._", "read_", "(_", ")_", "##", " ", "ends", " ", "with", " ", "\"", "I", " ", "give", " ", "up", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "err_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "'", "synta", "x", " ", "error", "'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "errors_", "._", "append_", "(_", "'-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lineno_", "=_", "int_", "(_", "line_", "._", "split_", "(_", "':'_", ")_", "[_", "-_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Syntax", " ", "Error", " ", "-", " ", "line", ":", " ", "%", "s", "'_", "%_", "lineno_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lineno_", "-_", "2_", "<_", "len_", "(_", "src", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "e_", "._", "append_", "(_", "src", "lines_", "[_", "lineno_", "-_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lineno_", "-_", "1_", "<_", "len_", "(_", "src", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "e_", "._", "append_", "(_", "src", "lines_", "[_", "lineno_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lineno_", "<_", "len_", "(_", "src", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "e_", "._", "append_", "(_", "src", "lines_", "[_", "lineno_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "errors_", "._", "extend_", "(_", "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\t", "\t\t\t\t\t_", "errors_", "._", "append_", "(_", "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_", "msg_", "=_", "[_", "'", " ", "'_", "._", "join_", "(_", "cmd_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "source_", "._", "splitlines_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "msg_", "._", "append_", "(_", "'%", "s", ":", "\t", "%", "s", "'_", "%_", "(_", "i_", "+_", "1_", ",_", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "._", "extend_", "(_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Run", "time", "Error_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "(_", "'", "WARN", "ING", ":", " ", "coul", "d", " ", "not", " ", "find", " ", "iver", "ilo", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "[_", "'", "code", "'_", "]_", "=_", "source_", "\\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_", "modules_", "[_", "'", "go", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "go", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "'", "name", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "name_", "=_", "mod_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "==_", "'", "main", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "go", "\\u", "main_", "[_", "'", "source", "'_", "]_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\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_", "output_", "[_", "'", "go", "'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "go", "\\u", "main_", "[_", "'", "source", "'_", "]_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\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_", "go", "\\u", "main_", "[_", "'", "source", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "go", "\\u", "main_", "[_", "'", "source", "'_", "]_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "go", "\\u", "main_", "[_", "'", "source", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "go", "'_", "]_", "._", "insert_", "(_", "0_", ",_", "go", "\\u", "main_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "output_", "[_", "'", "go", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "source_", "=_", "[_", "mod_", "[_", "'", "source", "'_", "]_", "for_", "mod_", "in_", "output_", "[_", "'", "go", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpfile_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "go", "-", "build", ".", "go", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpfile_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "source_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "GO", "\\u", "EXE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cmd_", "=_", "[_", "GO", "\\u", "EXE", "_", ",_", "'", "build", "'_", ",_", "tmpfile_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "GO", "\\u", "EXE", "_", ",_", "'", "build", "'_", ",_", "tmpfile_", "]_", ",_", "cwd_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "[_", "'", "binar", "y", "'_", "]_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "go", "-", "build", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "execute", "able", "s", "'_", "]_", "._", "append_", "(_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "go", "-", "build", "'_", ")_", "\\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_", "modules_", "[_", "'", "rust", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "source_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "mod_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "rust", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "source_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "name", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "name", "'_", "]_", "==_", "'", "main", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "main", "mod_", "=_", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "main", "mod_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "main", "mod_", "=_", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmpfile_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "build", ".", "rs", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpfile_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pak", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "modules_", "[_", "'", "c", "++'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "libname", "_", "=_", "'", "rust", "hon", "-", "lib", "%", "s", "'_", "%_", "len_", "(_", "output_", "[_", "'", "rust", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "._", "append_", "(_", "libname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "rust", "c", "'_", ",_", "'--", "crate", "-", "name", "'_", ",_", "'", "rust", "hon", "'_", ",_", "'--", "crate", "-", "type", "'_", ",_", "'", "static", "lib", "'_", ",_", "'-", "o", "'_", ",_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/'_", "+_", "libname", "_", ",_", "tmpfile_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pak", "_", "=_", "{_", "'", "source", "'_", ":_", "data_", ",_", "'", "static", "lib", "'_", ":_", "libname", "_", ",_", "'", "name", "'_", ":_", "'", "lib", "'_", "+_", "libname", "_", "+_", "'.", "a", "'_", "}_", "\\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_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "rust", "c", "'_", ",_", "'--", "crate", "-", "name", "'_", ",_", "'", "rust", "hon", "'_", ",_", "'-", "o", "'_", ",_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "bin", "'_", ",_", "tmpfile_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pak", "_", "=_", "{_", "'", "source", "'_", ":_", "data_", ",_", "'", "binar", "y", "'_", ":_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "bin", "'_", ",_", "'", "name", "'_", ":_", "'", "rust", "hon", "-", "bin", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "execute", "able", "s", "'_", "]_", "._", "append_", "(_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "bin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "pak", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "mod_", "[_", "'", "build", "'_", "]_", "=_", "pak", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "rust", "'_", "]_", "._", "append_", "(_", "pak", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "modules_", "[_", "'", "c", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "dynami", "clib", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cin", "clu", "de_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cb", "uild", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "c", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "'", "dynami", "c", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "dynami", "c", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "dynami", "clib", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "link", "-", "dirs", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "cin", "clu", "de_", "._", "extend_", "(_", "mod_", "[_", "'", "link", "-", "dirs", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "build", "-", "dirs", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "for_", "bdi", "r_", "in_", "mod_", "[_", "'", "build", "-", "dirs", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "for_", "fname_", "in_", "os_", "._", "listdir_", "(_", "bdi", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "if_", "fname_", "._", "endswith_", "(_", "'.", "c", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "cb", "uild", "_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "bdi", "r_", ",_", "fname_", ")_", ")_", "\\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_", "'", "code", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "code", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "source_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "module", " ", "must", " ", "contain", " ", "a", " ", "build", " ", "config_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "raise_", "Run", "time", "Error_", "(_", "'", "missi", "ng", " ", "code", "'_", ")_", "\\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_", "source_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "data_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpa", "k_", "=_", "{_", "'", "source", "'_", ":_", "data_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "c", "'_", "]_", "._", "append_", "(_", "cpa", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "libname", "_", "=_", "'", "default", "-", "clib", "%", "s", "'_", "%_", "len_", "(_", "output_", "[_", "'", "c", "'_", "]_", ")_", "##", " ", "TOD", "O", " ", "user", " ", "named_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "._", "append_", "(_", "libname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dynami", "c\\u", "path_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "lib", "'_", "+_", "libname", "_", "+_", "'.", "so", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "static", "\\u", "path_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "lib", "'_", "+_", "libname", "_", "+_", "'.", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "path_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/'_", "+_", "libname", "_", "+_", "'.", "o", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "build", ".", "c", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpfile_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "[_", "'", "gcc", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idi", "r_", "in_", "cin", "clu", "de_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "I", "'_", "+_", "idi", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "._", "extend_", "(_", "[_", "'-", "c", "'_", ",_", "tmpfile_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "dynami", "clib", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "cmd_", "._", "extend_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "f", "PIC", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "O", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "fo", "mit", "-", "frame", "-", "point", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "Wall", "'_", ",_", "'-", "Wn", "o", "-", "unu", "sed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "o", "'_", ",_", "object\\u", "path_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gcc", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "shared", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "Wl", ",-", "sona", "me", ",", "lib", "%", "s", ".", "so", "'_", "%_", "libname", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "-", "Wl", ",-", "rpath", ",", "/", "tmp", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "Wl", ",-", "-", "export", "-", "dynami", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "pthread", "'_", ",_", "'-", "o", "'_", ",_", "dynami", "c\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object\\u", "path_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpa", "k_", "[_", "'", "dynami", "clib", "'_", "]_", "=_", "dynami", "c\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpa", "k_", "[_", "'", "name", "'_", "]_", "=_", "'", "lib", "%", "s", ".", "so", "'_", "%_", "libname", "_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "cb", "uild", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "gcc", ":", " ", "fat", "al", " ", "error", ":", " ", "cann", "ot", " ", "speci", "fy", " ", "-", "o", " ", "with", " ", "-", "c", ",", " ", "-", "S", " ", "or", " ", "-", "E", " ", "with", " ", "multiple", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", ".", "extend", "(", "cb", "uild", ")", " ", " ", "##", " ", "extra", " ", "c", " ", "files", " ", "`", "/", "some", "/", "path", "/*", ".", "c", "`_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "raise_", "Run", "time", "Error_", "(_", "'", "TOD", "O", " ", "fix", " ", "buildi", "ng", " ", "multiple", " ", ".", "c", " ", "files", " ", "at", " ", "onc", "e", " ", "usi", "ng", " ", "gcc", " ", "option", " ", "-", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "._", "extend_", "(_", "[_", "'-", "o", "'_", ",_", "object\\u", "path_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'===", "=======", " ", "compil", "ing", " ", "C", " ", "static", " ", "librar", "y", " ", "=========", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", "'_", "._", "join_", "(_", "cmd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'===", "=======", " ", "ar", " ", ":", " ", "static", "lib", " ", "=========", "='_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "'", "ar", "'_", ",_", "'", "rcs", "'_", ",_", "static", "\\u", "path_", ",_", "object\\u", "path_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpa", "k_", "[_", "'", "static", "lib", "'_", "]_", "=_", "libname", "_", "+_", "'.", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpa", "k_", "[_", "'", "name", "'_", "]_", "=_", "libname", "_", "+_", "'.", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "modules_", "[_", "'", "c", "++'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "links_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idi", "rs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "c", "++'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "mod_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "builddir_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "compile", "\\u", "mode", " ", "=", " ", "'", "binar", "y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "'", "tag", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "tag", "'_", "]_", "and_", "(_", "mod_", "[_", "'", "tag", "'_", "]_", "._", "endswith_", "(_", "'.", "hp", "p", "'_", ")_", "or_", "mod_", "[_", "'", "tag", "'_", "]_", "._", "endswith_", "(_", "'.", "hp", "p", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "allow", "s", " ", "plain", " ", "header", " ", "files", " ", "to", " ", "be", " ", "include", "d", " ", "in", " ", "build", " ", "director", "y", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "open_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "builddir_", ",_", "mod_", "[_", "'", "tag", "'_", "]_", ")_", ",_", "'", "wb", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "write_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "c", "++'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\u\\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_", "source_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "name", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "name", "'_", "]_", "==_", "'", "main", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "main", "mod_", "=_", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "main", "mod_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "main", "mod_", "=_", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "link", "s", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "links_", "._", "extend_", "(_", "mod_", "[_", "'", "link", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "include", "-", "dirs", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "idi", "rs_", "._", "extend_", "(_", "mod_", "[_", "'", "include", "-", "dirs", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "defin", "es", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "defines_", "._", "extend_", "(_", "mod_", "[_", "'", "defin", "es", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "'", "compile", "-", "mode", "'", " ", "in", " ", "mod", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "compile", "\\u", "mode", " ", "=", " ", "mod", "['", "compile", "-", "mode", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "tag", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "tag", "'_", "]_", "and_", "'.'_", "not_", "in_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "exe", "name_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmpfile_", "=_", "builddir_", "+_", "'/", "rust", "hon", "-", "c", "++", "-", "build", ".", "cpp", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpfile_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "'", "g", "++'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "compile", "\\u", "mode_", "==_", "'", "binar", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cmd_", "._", "extend_", "(_", "[_", "'-", "O", "3", "'_", ",_", "'-", "fpro", "file", "-", "generat", "e", "'_", ",_", "'-", "march", "=", "nativ", "e", "'_", ",_", "'-", "mtu", "ne", "=", "nativ", "e", "'_", ",_", "'-", "I", "'_", "+_", "tempfile_", "._", "gettempdir_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "._", "append_", "(_", "'-", "Wl", ",-", "rpath", ",", "/", "usr", "/", "local", "/", "lib", "/'_", ")_", "##", " ", "extra", " ", "user", " ", "install", "ed", " ", "dynami", "c", " ", "libs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "append_", "(_", "'-", "Wl", ",-", "rpath", ",.", "/'_", ")_", "##", " ", "can", " ", "not", " ", "load", " ", "dynami", "c", " ", "libs", " ", "from", " ", "same", " ", "director", "y", " ", "with", "out", " ", "this_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "append_", "(_", "tmpfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'/'_", "in_", "exe", "name_", "and_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "builddir_", ",_", "os_", "._", "path_", "._", "split_", "(_", "exe", "name_", ")_", "[_", "0_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "os_", "._", "makedirs_", "(_", "os_", "._", "path_", "._", "join_", "(_", "builddir_", ",_", "os_", "._", "path_", "._", "split_", "(_", "exe", "name_", ")_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "compile", "\\u", "mode_", "==_", "'", "binar", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cmd_", "._", "extend_", "(_", "[_", "'-", "o", "'_", ",_", "os_", "._", "path_", "._", "join_", "(_", "builddir_", ",_", "exe", "name_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "compile", "\\u", "mode_", "==_", "'", "dynami", "clib", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cmd_", "._", "extend_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'-", "shared", "'_", ",_", "'-", "f", "PIC", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exe", "name_", "+=_", "'.", "so", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "extend_", "(_", "[_", "'-", "o", "'_", ",_", "os_", "._", "path_", "._", "join_", "(_", "builddir_", ",_", "exe", "name_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "._", "extend_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'-", "pthread", "'_", ",_", "'-", "std", "=", "c", "++", "11", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "D_", "in_", "defines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cmd_", "._", "append_", "(_", "'-", "D", "%", "s", "'_", "%_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "nu", "itk", "a_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "note", ":", " ", "linking", " ", "happ", "ens", " ", "after", " ", "the", " ", "object", "-", "bin", " ", "above", " ", "is", " ", "created", " ", "`-", "o", " ", "rust", "on", "-", "c", "++", "-", "bin", "`", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "fixes", " ", "the", " ", "error", ":", " ", "undefined", " ", "reference", " ", "to", " ", "`\\u", "Py", "Thread", "State", "\\u", "Curr", "ent", "',", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "not", " ", "nu", "itk", "a", "\\u", "include", "\\u", "path", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "nu", "itk", "a", "\\u", "include", "\\u", "path", " ", "=", " ", "'/", "usr", "/", "local", "/", "lib", "/", "python", "2.7", "/", "dist", "-", "package", "s", "/", "nu", "itk", "a", "/", "build", "/", "include", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", ".", "append", "('", "-", "I", "'+", "nu", "itk", "a", "\\u", "include", "\\u", "path", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cmd_", "._", "append_", "(_", "'-", "I", "/", "usr", "/", "include", "/", "python", "2.7", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "append_", "(_", "'-", "lp", "yth", "on2", ".7", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "idi", "rs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "idi", "r_", "in_", "idi", "rs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "I", "'_", "+_", "idi", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "links_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "lib_", "in_", "links_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "l", "'_", "+_", "lib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "alw", "ay", "s", " ", "link", " ", "to", " ", "lib", "dl", ",", " ", "external", " ", "librar", "ies", " ", "may", " ", "require", " ", "dl", "\\u", "open", ",", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "._", "append_", "(_", "'-", "ld", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "link_", "or_", "gi", "ws_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "gi", "ws_", ":_", "##", " ", "link", " ", "to", " ", "the", " ", "JV", "M", " ", "if", " ", "gi", "ws", " ", "bindi", "ngs", " ", "wer", "e", " ", "compile", "d", " ", "##", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "lj", "vm", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "LD", "\\u", "LIBRARY", "\\u", "PATH", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "for", " ", "jre", "path", " ", "in", " ", "'", "include", " ", "include", "/", "linux", " ", "jre", "/", "lib", "/", "i3", "86", " ", "jre", "/", "lib", "/", "i3", "86", "/", "client", "/'", ".", "split", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "jre", "path_", "in_", "'", "include", " ", "include", "/", "linux", "'_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "I", "%", "s", "/", "%", "s", "'_", "%_", "(_", "os_", "._", "environ_", "[_", "'", "JAVA", "\\u", "HOM", "E", "'_", "]_", ",_", "jre", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "jre", "path_", "in_", "'", "jre", "/", "lib", "/", "am", "d6", "4", " ", "jre", "/", "lib", "/", "am", "d6", "4", "/", "server", "/'_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "L", "%", "s", "/", "%", "s", "'_", "%_", "(_", "os_", "._", "environ_", "[_", "'", "JAVA", "\\u", "HOM", "E", "'_", "]_", ",_", "jre", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "LD", "\\u", "LIBRARY", "\\u", "PATH", "'_", "]_", "+=_", "':", "%", "s", "/", "%", "s", "'_", "%_", "(_", "os_", "._", "environ_", "[_", "'", "JAVA", "\\u", "HOM", "E", "'_", "]_", ",_", "jre", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "Run", "time", "Error", "(", "os", ".", "environ", "['", "LD", "\\u", "LIBRARY", "\\u", "PATH", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "else", ":", " ", " ", "##", " ", "TOD", "O", " ", "fix", " ", "jvm", " ", "with", " ", "static", " ", "c", " ", "libs_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "cmd", ".", "append", "('", "-", "static", "')", "_", "\\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_", "link_", ":_", "##", " ", "c", " ", "static", "libs", " ", "or", " ", "gi", "ws", " ", "c", "++", " ", "wrapp", "ers", " ", "##", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "L", "'_", "+_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/.", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "libname", "_", "in_", "link_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "l", "'_", "+_", "libname", "_", ")_", "\\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_", "print_", "(_", "'===", "=======", " ", "g", "++", " ", ":", " ", "compile", " ", "main", " ", "=========", "='_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", "'_", "._", "join_", "(_", "cmd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "mod_", "[_", "'", "build", "'_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ":_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "binar", "y", "'_", ":_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/'_", "+_", "exe", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "exe", "name_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "compile", "\\u", "mode_", "==_", "'", "binar", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "output_", "[_", "'", "c", "++'_", "]_", "._", "append_", "(_", "main", "mod_", "[_", "'", "build", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "execute", "able", "s", "'_", "]_", "._", "append_", "(_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/'_", "+_", "exe", "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\t", "\t\t_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "exe", "name_", "]_", "=_", "open_", "(_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/'_", "+_", "exe", "name_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\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_", "python", "\\u", "main_", "[_", "'", "script", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "python", "\\u", "main_", "[_", "'", "script", "'_", "]_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "python", "\\u", "main_", "[_", "'", "script", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "python", "'_", "]_", "._", "append_", "(_", "python", "\\u", "main_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "modules_", "[_", "'", "bazel", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "http", "://", "bazel", ".", "io", "/", "docs", "/", "build", "-", "ref", ".", "html", "#", "workspaces", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "a", " ", "WORKS", "PACE", " ", "file", " ", "is", " ", "require", "d", ",", " ", "even", " ", "if", " ", "empty", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "tmpdir_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpdir_", "+_", "'/", "WORKS", "PACE", "'_", ",_", "'", "wb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "filename_", "in_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "open_", "(_", "tmpdir_", "+_", "'/'_", "+_", "filename_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "filename_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bazel", "builds_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "bazel", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "bazel", "config_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpdir_", "+_", "'/", "BUILD", "'_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "bazel", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "chk_", "in_", "bazel", "config_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "chk_", "=_", "chk_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "chk_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "chk_", "._", "endswith_", "(_", "'\"'_", ")_", "and_", "'", "name", "'_", "in_", "words_", "and_", "'='_", "in_", "words_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "chk_", "=_", "chk_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bazel", "builds_", "._", "append_", "(_", "chk_", "[_", "-_", "1_", "]_", "[_", "1_", ":_", "-_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "bazel", "builds_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build", "name_", "=_", "bazel", "builds_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "subproc", "ess", ".", "check", "\\u", "call", "([", "'", "bazel", "',", " ", "'", "build", "',", " ", "':", "'+", "build", "name", "],", " ", "cw", "d", "=", "tmpdir", ")_", "\\u\\u\\uNL\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "bazel", "'_", ",_", "'", "run", "'_", ",_", "':'_", "+_", "build", "name_", "]_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "gyp", "\\u", "builds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "tmpdir_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "gname", "_", "in_", "gyp", "\\u", "builds_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "gb", "uild", "_", "=_", "gyp", "\\u", "builds_", "[_", "gname", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "gb", "uild", "_", "[_", "'", "src", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "open_", "(_", "tmpdir_", "+_", "'/", "bindi", "ng", ".", "gyp", "'_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "gb", "uild", "_", "[_", "'", "gyp", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpdir_", "+_", "'/'_", "+_", "gname", "_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "gb", "uild", "_", "[_", "'", "src", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "nw", "-", "gyp", "'_", ",_", "'", "configur", "e", "'_", ",_", "'--", "target", "=", "0.12", ".3", "'_", "]_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "nw", "-", "gyp", "'_", ",_", "'", "build", "'_", "]_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node", "\\u", "module_", "=_", "open_", "(_", "tmpdir_", "+_", "'/", "build", "/", "Release", "/", "bindi", "ng", ".", "node", "'_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "'", "bindi", "ng", ".", "node", "'_", "]_", "=_", "node", "\\u", "module_", "\\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_", "return_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "first", "\\u", "build", "\\u", "from", "\\u", "package_", "(_", "package_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "for_", "lang_", "in_", "'", "rust", " ", "c", "++", " ", "go", " ", "javascript", " ", "python", " ", "html", " ", "veri", "log", " ", "java", " ", "nim", " ", "dart", " ", "lua", "'_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "pak", "_", "in_", "package_", "[_", "lang_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "pak", "_", "\\u\\u\\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_", "save", "\\u", "tar_", "(_", "package_", ",_", "path_", "=_", "'", "build", ".", "tar", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "import_", "tarfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tar_", "=_", "tarfile_", "._", "Tar", "File_", "(_", "path_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "package_", "[_", "'", "datadir", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "datadir_", "in_", "package_", "[_", "'", "datadir", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "datadir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "for_", "name_", "in_", "os_", "._", "listdir_", "(_", "datadir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "a_", "=_", "os_", "._", "path_", "._", "join_", "(_", "datadir_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tar_", "._", "add_", "(_", "a_", ")_", "##", " ", "files", " ", "and", " ", "folders_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "path_", "._", "isfile_", "(_", "datadir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "tar_", "._", "add_", "(_", "datadir_", ")_", "\\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_", "package_", "[_", "'", "datafile", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "fpath_", "in_", "package_", "[_", "'", "datafile", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "fdata", "_", "=_", "package_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "fpath_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "write_", "(_", "fdata", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ti_", "=_", "tarfile_", "._", "Tar", "Info_", "(_", "name_", "=_", "fpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ti_", "._", "size_", "=_", "len_", "(_", "s_", "._", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tar_", "._", "addfi", "le_", "(_", "tari", "nfo_", "=_", "ti_", ",_", "fileobj_", "=_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exts_", "=_", "{_", "'", "rust", "'_", ":_", "'.", "rs", "'_", ",_", "'", "c", "++'_", ":_", "'.", "cpp", "'_", ",_", "'", "c", "#'_", ":_", "'.", "cs", "'_", ",_", "'", "javascript", "'_", ":_", "'.", "js", "'_", ",_", "'", "json", "'_", ":_", "'.", "json", "'_", ",_", "'", "python", "'_", ":_", "'.", "py", "'_", ",_", "'", "go", "'_", ":_", "'.", "go", "'_", ",_", "'", "html", "'_", ":_", "'.", "html", "'_", ",_", "'", "veri", "log", "'_", ":_", "'.", "sv", "'_", ",_", "'", "nim", "'_", ":_", "'.", "nim", "'_", ",_", "'", "java", "'_", ":_", "'.", "java", "'_", ",_", "'", "dart", "'_", ":_", "'.", "dart", "'_", ",_", "'", "lua", "'_", ":_", "'.", "lua", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lang_", "in_", "'", "rust", " ", "c", " ", "c", "++", " ", "c", "#", " ", "go", " ", "javascript", " ", "json", " ", "python", " ", "xml", " ", "html", " ", "veri", "log", " ", "java", " ", "nim", " ", "dart", " ", "lua", "'_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "info_", "in_", "package_", "[_", "lang_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "name_", "=_", "'", "unti", "tle", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "name", "'_", "in_", "info_", "and_", "info_", "[_", "'", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "name_", "=_", "info_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "bin_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "dynami", "clib", "'_", "in_", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "s_", "._", "write_", "(_", "open_", "(_", "info_", "[_", "'", "dynami", "clib", "'_", "]_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "source", "'_", "in_", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "source_", "=_", "info_", "[_", "'", "source", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "static", "lib", "'_", "in_", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "s_", "._", "write_", "(_", "open_", "(_", "info_", "[_", "'", "static", "lib", "'_", "]_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "source", "'_", "in_", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "source_", "=_", "info_", "[_", "'", "source", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "binar", "y", "'_", "in_", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "s_", "._", "write_", "(_", "open_", "(_", "info_", "[_", "'", "binar", "y", "'_", "]_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "info_", "[_", "'", "source", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "bin_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "code", "'_", "in_", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "lang_", "==_", "'", "veri", "log", "'_", ":_", "print_", "(_", "info_", "[_", "'", "code", "'_", "]_", ")_", "##", " ", "just", " ", "for", " ", "testi", "ng", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "write_", "(_", "info_", "[_", "'", "code", "'_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "script", "'_", "in_", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "s_", "._", "write_", "(_", "info_", "[_", "'", "script", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "is", "\\u", "bin_", "and_", "not_", "source_", "and_", "not_", "name_", "._", "endswith_", "(_", "exts_", "[_", "lang_", "]_", ")_", "and_", "'.'_", "not_", "in_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "name_", "+=_", "exts_", "[_", "lang_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ti_", "=_", "tarfile_", "._", "Tar", "Info_", "(_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ti_", "._", "size_", "=_", "len_", "(_", "s_", "._", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "bin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "ti_", "._", "mode_", "=_", "0o7", "77_", "\\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\t", "\t\t\t_", "tar_", "._", "addfi", "le_", "(_", "tari", "nfo_", "=_", "ti_", ",_", "fileobj_", "=_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Encode", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "s_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "s_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "err_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "source_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "s_", "=_", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "write_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "source", "-", "name", "'_", "in_", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "ti_", "=_", "tarfile_", "._", "Tar", "Info_", "(_", "name_", "=_", "info_", "[_", "'", "source", "-", "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\t", "\t\t\t\t_", "ti_", "=_", "tarfile_", "._", "Tar", "Info_", "(_", "name_", "=_", "name_", "+_", "'-", "source", "'_", "+_", "exts_", "[_", "lang_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ti_", "._", "size_", "=_", "len_", "(_", "s_", "._", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tar_", "._", "addfi", "le_", "(_", "tari", "nfo_", "=_", "ti_", ",_", "fileobj_", "=_", "s_", ")_", "\\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_", "tar_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\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\\uINDENT\\u\\u\\u\t", "_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", "==_", "1_", "or_", "'--", "help", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "print_", "(_", "'", "usage", ":", " ", "./", "rust", "hon", ".", "py", " ", "[", "python", " ", "files", "]", " ", "[", "mark", "down", " ", "files", "]", " ", "[", "tar", " ", "file", "]", " ", "[-", "-", "release", "]", " ", "[-", "-", "run", "=", "]", " ", "[-", "-", "data", "=", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "\t", "\t", "[", "tar", " ", "file", "]", " ", "is", " ", "the", " ", "option", "al", " ", "name", " ", "of", " ", "the", " ", "output", " ", "tar", " ", "tha", "t", " ", "contain", "s", " ", "the", " ", "build", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "\t", "\t", "source", " ", "files", ",", " ", "transp", "ile", "d", " ", "source", ",", " ", "and", " ", "output", " ", "binaries", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "\t", "\t", "--", "release", " ", "generat", "es", " ", "optimize", "d", " ", "output", " ", "with", "out", " ", "extra", " ", "runt", "ime", " ", "checks", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "\t", "\t", "--", "run", " ", "is", " ", "give", "n", " ", "a", " ", "list", " ", "of", " ", "program", "s", " ", "to", " ", "run", ",", " ", "\"--", "run", "=", "a", ".", "py", ",", "b", ".", "py", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "\t", "\t", "a", ".", "py", " ", "and", " ", "b", ".", "py", " ", "can", " ", "be", " ", "run", " ", "this", " ", "way", " ", "by", " ", "nami", "ng", " ", "the", " ", "code", " ", "blocks", " ", "in", " ", "the", " ", "mark", "down", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "\t", "\t", "usi", "ng", " ", "the", " ", "tag", " ", "synta", "x", " ", "\"@", "a", ".", "py", "\"", " ", "on", " ", "the", " ", "line", " ", "bef", "ore", " ", "the", " ", "code", " ", "block", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "\t", "\t", "--", "data", " ", "is", " ", "give", "n", " ", "a", " ", "list", " ", "of", " ", "director", "ies", " ", "to", " ", "include", " ", "in", " ", "the", " ", "build", " ", "dir", " ", "and", " ", "tar", "file", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "\t", "\t", "--", "obf", "usc", "ate", " ", "produce", "s", " ", "random", " ", "names", " ", "for", " ", "unicode", " ", "function", "s", " ", "and", " ", "variab", "les", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "\t", "\t", "--", "litera", "te", "-", "unicode", " ", "enable", "s", " ", "unicode", " ", "variab", "les", " ", "names", " ", "to", " ", "be", " ", "output", " ", "for", " ", "the", " ", "javascript", " ", "back", "end", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "\t", "\t", "--", "convert", "2py", "tho", "n", "=", "MY", "OUTPU", "T", " ", "strip", "s", " ", "awa", "y", " ", "static", " ", "type", " ", "annot", "ation", "s", ",", " ", "to", " ", "run", " ", "your", " ", "script", " ", "in", " ", "regular", " ", "Pyth", "on", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "\t", "\t", "--", "anaconda", " ", "run", " ", "scripts", " ", "with", " ", "Ana", "cond", "a", " ", "Pyth", "on", ",", " ", "must", " ", "be", " ", "install", "ed", " ", "to", " ", "~", "/", "anaconda", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "\t", "\t", "--", "transp", "arent", " ", "linux", " ", "and", " ", "NW", ".", "js", " ", "only", " ", "(", "force", "s", " ", "window", " ", "transparency", " ", "and", " ", "disable", "s", " ", "GPU", " ", "acceleration", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "\t", "\t", "--", "debug", "-", "inter", " ", "print", " ", "intermediate", " ", "translatio", "n", " ", "code", " ", "and", " ", "then", " ", "exit", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "\t", "\t", "note", ":", " ", "whe", "n", " ", "usi", "ng", " ", "regular", " ", "python", " ", "files", " ", "(.", "py", ")", " ", "as", " ", "input", " ", "inst", "ead", " ", "of", " ", "mark", "down", " ", "(.", "md", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "\t", "\t", "you", " ", "can", " ", "use", " ", "these", " ", "extra", " ", "options", " ", "to", " ", "set", " ", "whi", "ch", " ", "back", "end", " ", "is", " ", "used", " ", "by", " ", "the", " ", "transp", "iler", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "backend_", "in_", "'--", "c", "++", " ", "--", "javascript", " ", "--", "go", " ", "--", "rust", "'_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "(_", "'", "\t", "\t", "'_", "+_", "backend_", ")_", "\\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_", "modules_", "=_", "new", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "save_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paths_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scripts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mark", "downs", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gen", "\\u", "md_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "tar_", "=_", "'", "rust", "hon", "-", "build", ".", "tar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "dir_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "launch_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datadir", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j", "2r", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anaconda", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "convert", "2py", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "arg_", "in_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "paths_", "._", "append_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arg_", "._", "startswith_", "(_", "'--", "data", "='_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "datadir", "s_", "._", "extend_", "(_", "arg_", "._", "split_", "(_", "'='_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "','_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arg_", "._", "startswith_", "(_", "'--", "run", "='_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "launch_", "._", "extend_", "(_", "arg_", "._", "split_", "(_", "'='_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "','_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arg_", "._", "startswith_", "(_", "'--", "output", "='_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "output", "\\u", "file_", "=_", "arg_", "._", "split_", "(_", "'='_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arg_", "._", "startswith_", "(_", "'--", "output", "-", "dir", "='_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "output", "\\u", "dir_", "=_", "arg_", "._", "split_", "(_", "'='_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "output", "\\u", "dir_", "._", "startswith_", "(_", "'~'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "output", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "output", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arg_", "._", "startswith_", "(_", "'--", "convert", "2py", "tho", "n", "='_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "convert", "2py", "_", "=_", "arg_", "._", "split_", "(_", "'='_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arg_", "._", "endswith_", "(_", "'.", "py", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "scripts_", "._", "append_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arg_", "._", "endswith_", "(_", "'.", "md", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mark", "downs", "_", "._", "append_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arg_", "._", "endswith_", "(_", "'.", "tar", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "output", "\\u", "tar_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arg_", "==_", "'--", "generat", "e-", "mark", "down", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "gen", "\\u", "md_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arg_", "==_", "'--", "tar", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "save_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arg_", "==_", "'--", "java", "2r", "ust", "hon", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "j", "2r", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arg_", "==_", "'--", "anaconda", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "anaconda", "_", "=_", "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_", "datadir", "s_", "=_", "[_", "os_", "._", "path_", "._", "expanduser_", "(_", "dd_", ")_", "for_", "dd_", "in_", "datadir", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "j", "2r", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "path_", "in_", "paths_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "m_", "=_", "convert", "\\u", "to", "\\u", "mark", "down", "\\u", "project_", "(_", "path_", ",_", "java_", "=_", "True_", ",_", "java", "2r", "ust", "hon", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Run", "time", "Error_", "(_", "'", "TOD", "O", ":", " ", "%", "s", "'_", "%_", "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_", "gen", "\\u", "md_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "path_", "in_", "paths_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mds", "_", "=_", "convert", "\\u", "to", "\\u", "mark", "down", "\\u", "project_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "output", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "raise_", "Run", "time", "Error_", "(_", "'%", "s", " ", "\\\\", "n", " ", "ERROR", ":", " ", "no", " ", "output", " ", "file", " ", "give", "n", " ", "`-", "-", "output", "=", "mypro", "ject", ".", "md", "`'_", "%_", "mds", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "path_", "._", "isdir_", "(_", "output", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "write", " ", "as", " ", "multiple", " ", "mark", "downs", " ", "int", "o", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "for_", "m_", "in_", "mds", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "m_", "[_", "'", "name", "'_", "]_", "._", "count_", "(_", "'.'_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "mname_", "=_", "m_", "[_", "'", "name", "'_", "]_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "+_", "'.", "md", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "mname_", "=_", "m_", "[_", "'", "name", "'_", "]_", "+_", "'.", "md", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mpat", "h_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "file_", ",_", "mname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "writ", "ing", "->", " ", "%", "s", "'_", "%_", "mpat", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "mpat", "h_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "m_", "[_", "'", "mark", "down", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "not_", "output", "\\u", "file_", "._", "endswith_", "(_", "'.", "md", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "output", "\\u", "file_", "+=_", "'.", "md", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "md_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "[_", "m_", "[_", "'", "mark", "down", "'_", "]_", "for_", "m_", "in_", "mds", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "output", "\\u", "file_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\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_", "convert", "2py", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "strip", "s", " ", "awa", "y", " ", "rust", "hon", " ", "type", " ", "annot", "ation", "s", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "not_", "len_", "(_", "scripts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "Run", "time", "Error_", "(_", "'", "the", " ", "option", " ", "--", "convert", "2py", "tho", "n", "=", "myo", "ut", "put", " ", "require", "s", " ", "an", " ", "input", " ", "script", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "scripts_", ")_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "Run", "time", "Error_", "(_", "'", "the", " ", "option", " ", "--", "convert", "2py", "tho", "n", "=", "myo", "ut", "put", " ", "require", "s", " ", "a", " ", "single", " ", "input", " ", "script", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "a_", "=_", "typed", "python_", "._", "transform", "\\u", "source_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "open_", "(_", "scripts_", "[_", "0_", "]_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strip_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "convert", "2py", "_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "base", "\\u", "path_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single", "out_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "path_", "in_", "scripts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "note", ":", " ", ".", "decode", "('", "utf", "-", "8", "')", " ", "is", " ", "not", " ", "require", "d", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "shou", "ld", " ", "als", "o", " ", "check", " ", "the", " ", "strip", " ", "to", " ", "ensure", " ", "the", " ", "user", " ", "has", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "used", " ", "unicode", " ", "string", "s", " ", "startin", "g", " ", "with", " ", "the", " ", "`", "u", "`", " ", "prefix", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "bec", "aus", "e", " ", "tha", "t", " ", "will", " ", "break", " ", "the", " ", "translator", ",", " ", "bec", "aus", "e", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "promote", "s", " ", "tho", "se", " ", "string", "s", " ", "to", " ", "unicode", " ", "object", "s", " ", "in", " ", "the", " ", "AST", " ", "(", "whi", "ch", " ", "is", " ", "writt", "en", " ", "in", " ", "Pyth", "on2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "script_", "=_", "open_", "(_", "path_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'--", "c", "++'_", "in_", "sys_", "._", "argv_", ":_", "script_", "=_", "'#", "back", "end", ":", "c", "++", "\\\\", "n", "'_", "+_", "script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "'--", "javascript", "'_", "in_", "sys_", "._", "argv_", ":_", "script_", "=_", "'#", "back", "end", ":", "javascript", "\\\\", "n", "'_", "+_", "script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "'--", "rust", "'_", "in_", "sys_", "._", "argv_", ":_", "script_", "=_", "'#", "back", "end", ":", "rust", "\\\\", "n", "'_", "+_", "script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "'--", "go", "'_", "in_", "sys_", "._", "argv_", ":_", "script_", "=_", "'#", "back", "end", ":", "go", "\\\\", "n", "'_", "+_", "script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "'--", "dart", "'_", "in_", "sys_", "._", "argv_", ":_", "raise_", "Run", "time", "Error_", "(_", "'", "dart", " ", "back", "end", " ", "remove", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "'--", "lua", "'_", "in_", "sys_", "._", "argv_", ":_", "raise_", "Run", "time", "Error_", "(_", "'", "lua", " ", "back", "end", " ", "remove", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "'--", "veri", "log", "'_", "in_", "sys_", "._", "argv_", ":_", "script_", "=_", "'#", "back", "end", ":", "veri", "log", "\\\\", "n", "'_", "+_", "script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "script_", "=_", "'#", "back", "end", ":", "javascript", "\\\\", "n", "'_", "+_", "script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fpath_", ",_", "fname_", "=_", "os_", "._", "path_", "._", "split_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "=_", "fname_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single", "mod_", "=_", "{_", "'", "name", "'_", ":_", "'", "main", "'_", ",_", "'", "tag", "'_", ":_", "tag_", ",_", "'", "code", "'_", ":_", "script_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modules_", "[_", "'", "rust", "hon", "'_", "]_", "._", "append_", "(_", "single", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "base", "\\u", "path_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "base", "\\u", "path_", "=_", "os_", "._", "path_", "._", "split_", "(_", "path_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "single", "out_", "is_", "None_", "and_", "output", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "single", "out_", "=_", "single", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "path_", "in_", "mark", "downs", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "import", "\\u", "md_", "(_", "path_", ",_", "modules_", "=_", "modules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "base", "\\u", "path_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "base", "\\u", "path_", "=_", "os_", "._", "path_", "._", "split_", "(_", "path_", ")_", "[_", "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_", "package_", "=_", "build_", "(_", "modules_", ",_", "base", "\\u", "path_", ",_", "datadir", "s_", "=_", "datadir", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "single", "out_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "pak", "_", "=_", "get", "\\u", "first", "\\u", "build", "\\u", "from", "\\u", "package_", "(_", "package_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "source", "'_", "in_", "pak", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "open_", "(_", "output", "\\u", "file_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "pak", "_", "[_", "'", "source", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "code", "'_", "in_", "pak", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "open_", "(_", "output", "\\u", "file_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "pak", "_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "script", "'_", "in_", "pak", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "open_", "(_", "output", "\\u", "file_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "pak", "_", "[_", "'", "script", "'_", "]_", ")_", "\\u\\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_", "raise_", "Run", "time", "Error_", "(_", "pak", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'", "saved", " ", "output", " ", "to", ":", " ", "%", "s", "'_", "%_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "save_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "tmpdir_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "copy", " ", "jar", " ", "and", " ", "other", " ", "extra", " ", "librar", "ies", " ", "files", " ", "files", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "p_", "in_", "datadir", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "save", "s", " ", "jar", " ", "and", " ", "other", " ", "files", " ", "like", " ", "dynami", "c", " ", "librar", "ies", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "need", "ed", " ", "to", " ", "do", " ", "quick", " ", "testi", "ng", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "'.'_", "in_", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "dpath_", ",_", "dname_", "=_", "os_", "._", "path_", "._", "split_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "dname_", ")_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "open_", "(_", "p_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\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_", "exe_", "in_", "package_", "[_", "'", "execute", "able", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "(_", "'", "runn", "ing", ":", " ", "%", "s", "'_", "%_", "exe_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "exe_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cwd_", "=_", "tmpdir_", "##", " ", "jvm", " ", "need", "s", " ", "this", " ", "to", " ", "find", " ", "the", " ", ".", "class", " ", "files_", "\\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_", "package_", "[_", "'", "html", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "i_", ",_", "page_", "in_", "enumerate_", "(_", "package_", "[_", "'", "html", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "tname_", "=_", "'", "rust", "hon", "-", "webpage", "%", "s", ".", "html", "'_", "%_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "name", "'_", "in_", "page_", "and_", "page_", "[_", "'", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "tname_", "=_", "page_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/'_", "+_", "tname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "'", "dar", "win", "'_", ":_", "##", " ", "force", " ", "/", "tmp", " ", "director", "y", " ", "on", " ", "OSX", ",", " ", "make", "s", " ", "debugg", "ing", " ", "the", " ", "output", " ", "simple", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "tmp_", "=_", "'/", "tmp", "/'_", "+_", "tname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "note", " ", "in", " ", "Chrom", "e", " ", "UT", "F", "-", "8", " ", "javascript", " ", "will", " ", "fail", " ", "with", " ", "this", " ", "error", ":", " _", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "`", "Une", "xpe", "cte", "d", " ", "token", " ", "ILL", "EGA", "L", "`", " ", "with", " ", "unicode", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "the", " ", "file", " ", "must", " ", "be", " ", "writt", "en", " ", "as", " ", "UT", "F", "-1", "6._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "225", "433", "5", "4", "/", "how", "-", "well", "-", "is", "-", "node", "-", "js", "-", "support", "-", "for", "-", "unicode_", "\\u\\u\\uNL\\u\\u\\u_", "#", "open", "(", "tmp", ",", " ", "'", "wb", "')", ".", "write", "(", " ", "page", "['", "code", "']", ".", "encode", "('", "utf", "-", "8", "')", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "open_", "(_", "tmp_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "page_", "[_", "'", "code", "'_", "]_", "._", "encode_", "(_", "'", "utf", "-1", "6", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "i_", "<_", "len_", "(_", "package_", "[_", "'", "html", "'_", "]_", ")_", "-_", "1_", ":_", "##", " ", "only", " ", "launch", " ", "the", " ", "last", " ", "html", " ", "file", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "==_", "'", "dar", "win", "'_", "and_", "not_", "node", "webkit", "\\u", "runnable", "_", ":_", "##", " ", "hack", " ", "for", " ", "OSX", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "subprocess_", "._", "call_", "(_", "[_", "'", "open", "'_", ",_", "tmp_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "node", "webkit", "\\u", "runnable", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "node", "webkit", " ", "look", "s", " ", "for", " ", "`", "package", ".", "json", "`", " ", "in", " ", "the", " ", "folder", " ", "it", " ", "is", " ", "give", "n", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "nw", "cfg_", "=_", "'{", "\"", "name", "\":\"", "test", "\",", " ", "\"", "main", "\":\"", "%", "s", "\",", " ", "'_", "%_", "os_", "._", "path_", "._", "split_", "(_", "tmp_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'--", "frame", "less", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "nw", "cfg_", "+=_", "'\"", "window", "\":{", "\"", "widt", "h", "\":", "1200", ",", " ", "\"", "height", "\":", "680", ",", " ", "\"", "toolb", "ar", "\":", "fal", "se", ",", " ", "\"", "frame", "\":", "fal", "se", "}}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'--", "desk", "top", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "note", " ", "as", "\\u", "desk", "top", " ", "is", " ", "broken", " ", "in", " ", "new", " ", "NW", ".", "js_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "https", "://", "git", "hub", ".", "com", "/", "nw", "js", "/", "nw", ".", "js", "/", "issue", "s", "/", "283", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "nw", "cfg_", "+=_", "'\"", "window", "\":{", "\"", "widt", "h", "\":", "1200", ",", " ", "\"", "height", "\":", "680", ",", " ", "\"", "toolb", "ar", "\":", "fal", "se", ",", " ", "\"", "as", "\\u", "desk", "top", "\":", "true", ",", " ", "\"", "frame", "\":", "fal", "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\t", "\t\t\t\t\t_", "nw", "cfg_", "+=_", "'\"", "window", "\":{", "\"", "widt", "h", "\":", "1200", ",", " ", "\"", "height", "\":", "680", ",", " ", "\"", "toolb", "ar", "\":", "fal", "se", "}}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "\"", "package", ".", "json", "\"_", ")_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "nw", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nw", "cmd_", "=_", "[_", "node", "webkit", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'--", "v", "8", "-", "nativ", "es", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "nw", "cmd_", "._", "append_", "(_", "'--", "allow", "-", "nativ", "es", "-", "synta", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "'", "linux", "2", "'_", "and_", "'--", "transp", "arent", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "nw", "cmd_", "._", "extend_", "(_", "[_", "'--", "enable", "-", "transp", "arent", "-", "visu", "als", "'_", ",_", "'--", "disable", "-", "gpu", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nw", "cmd_", "._", "append_", "(_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "Popen_", "(_", "nw", "cmd_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\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_", "webbrowser_", "._", "open_", "(_", "tmp_", ")_", "\\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_", "package_", "[_", "'", "javascript", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "tmpdir_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pak", "_", "in_", "package_", "[_", "'", "javascript", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "fname_", "=_", "pak", "_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fname_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "fname_", "=_", "'", "rust", "hon", "-", "temp", ".", "js", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "fname_", "._", "endswith_", "(_", "'.", "js", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "fname_", "+=_", "'.", "js", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fpath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "fpath_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "pak", "_", "[_", "'", "script", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "xxx", " ", "=", " ", "pak", "['", "script", "']", ".", "decode", "('", "utf", "-", "8", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "open", "(", "fpath", ",", " ", "'", "wb", "')", ".", "write", "(", " ", "xxx", ".", "encode", "('", "utf", "-1", "6", "')", " ", ")", " ", " ", "##", " ", "TOD", "O", " ", "fix", " ", "node", "js", " ", "unicode_", "\\u\\u\\uNL\\u\\u\\u_", "#", "codec", "s", ".", "open", "(", "fpath", ",", " ", "'", "w", "',", " ", "'", "utf", "-", "8", "')", ".", "write", "(", " ", "pak", "['", "script", "']", " ", ")", " ", " ", "##", " ", "TOD", "O", " ", "fix", " ", "node", "js", " ", "unicode_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'--", "v", "8", "-", "nativ", "es", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "node", "js", "\\u", "exe_", ",_", "'--", "allow", "-", "nativ", "es", "-", "synta", "x", "'_", ",_", "fpath_", "]_", ")_", "\\u\\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_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "node", "js", "\\u", "exe_", ",_", "fpath_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "save", "\\u", "tar_", "(_", "package_", ",_", "output", "\\u", "tar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "saved", " ", "build", " ", "to", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "output", "\\u", "tar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "launch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "tmpdir_", "=_", "output", "\\u", "dir_", "or_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "tar_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "'", "temp", ".", "tar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmp", "tar_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "open_", "(_", "output", "\\u", "tar_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "tar", "'_", ",_", "'-", "xv", "f", "'_", ",_", "tmp", "tar_", "]_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "=_", "subprocess_", "._", "call_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "launch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "name_", "==_", "launch_", "[_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "run_", "=_", "subprocess_", "._", "check", "\\u", "call_", "\\u\\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_", "run_", "=_", "subprocess_", "._", "Popen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "name_", "._", "endswith_", "(_", "'.", "py", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "firstl", "ine_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "name_", ")_", ",_", "'", "rb", "'_", ")_", "._", "readlines_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "python_", "=_", "'", "python", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "firstl", "ine_", "._", "startswith_", "(_", "'#", "!'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "if_", "'", "python", "3", "'_", "in_", "firstl", "ine_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "python_", "=_", "'", "python", "3", "'_", "\\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_", "anaconda", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "assume", " ", "tha", "t", " ", "the", " ", "user", " ", "install", "ed", " ", "anaconda", " ", "to", " ", "the", " ", "default", " ", "location", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "ana", "bin_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/", "anaconda", "/", "bin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "ana", "bin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "raise_", "Run", "time", "Error_", "(_", "'", "Ana", "cond", "a", " ", "Pyth", "on", " ", "not", " ", "install", "ed", " ", "to", " ", "default", " ", "location", ":", " ", "%", "s", "'_", "%_", "ana", "bin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run_", "(_", "[_", "os_", "._", "path_", "._", "join_", "(_", "ana", "bin_", ",_", "python_", ")_", ",_", "name_", "]_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\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_", "run_", "(_", "[_", "python_", ",_", "name_", "]_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\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_", "name_", "._", "endswith_", "(_", "'.", "js", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "run_", "(_", "[_", "'", "node", "'_", ",_", "name_", "]_", ",_", "cwd_", "=_", "tmpdir_", ",_", "env_", "=_", "{_", "'", "NODE", "\\u", "PATH", "'_", ":_", "'/", "usr", "/", "lib", "/", "node", "\\u", "module", "s", "/'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "._", "endswith_", "(_", "'.", "nim", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "run_", "(_", "[_", "'", "nim", "'_", ",_", "'", "compile", "'_", ",_", "'--", "run", "'_", ",_", "name_", "]_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "._", "endswith_", "(_", "'.", "go", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "run_", "(_", "[_", "'", "go", "'_", ",_", "'", "run", "'_", ",_", "name_", "]_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "._", "endswith_", "(_", "'.", "lua", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "run_", "(_", "[_", "'", "lua", "jit", "'_", ",_", "name_", "]_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "._", "endswith_", "(_", "'.", "dart", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "dart", "bin_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/", "dart", "-", "sd", "k", "/", "bin", "/", "dart", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "[_", "dart", "bin_", ",_", "name_", "]_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "._", "endswith_", "(_", "'.", "html", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "sys_", "._", "platform_", "==_", "'", "dar", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "subprocess_", "._", "call_", "(_", "[_", "'", "open", "'_", ",_", "tmpdir_", "+_", "'/'_", "+_", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "node", "webkit", "\\u", "runnable", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "raise_", "Run", "time", "Error_", "(_", "'", "todo", " ", "node", "webkit", "xx", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "call_", "(_", "[_", "node", "webkit", "_", ",_", "tmp_", "]_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "webbrowser_", "._", "open_", "(_", "tmpdir_", "+_", "'/'_", "+_", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "print_", "'", "runn", "ing", ":", " ", "%", "s", "'_", "%_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "[_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "name_", ")_", "]_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "rust", "hon", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "rust", "hon", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "translate_", "(_", "cls_", ",_", "code_", ",_", "mode_", "=_", "'", "mark", "down", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "mode_", "==_", "'", "javascript", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "js_", "=_", "compile", "\\u", "js_", "(_", "code_", ",_", "'/", "tmp", "'_", ",_", "main", "\\u", "name_", "=_", "'", "main", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "js_", "[_", "'", "main", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "'", "c", "++'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "code_", ",_", "cpp_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pak", "_", "=_", "translat", "e\\u", "to", "\\u", "cpp_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pyj", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "insert", "\\u", "runtime_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "pak", " ", "contain", "s", ":", " ", "c\\u", "header", " ", "and", " ", "cpp", "\\u", "header_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "pak", "_", "[_", "'", "main", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "'", "go", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "code_", ",_", "go_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "translat", "e\\u", "to", "\\u", "go_", "(_", "pyj", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "'", "rust", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "code_", ",_", "rust", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "translat", "e\\u", "to", "\\u", "rust", "_", "(_", "pyj", "s_", ")_", "\\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_", "#", "module", "s", " ", "=", " ", "new", "\\u", "module", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "import", "\\u", "md", "(", " ", "path", ",", " ", "module", "s", "=", "module", "s", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "base", "\\u", "path_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "=_", "build_", "(_", "modules_", ",_", "base", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Run", "time", "Error_", "(_", "package_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "boots", "trap", "\\u", "rust", "hon", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "global_", "BOOT", "STRA", "PED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locald", "ir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "unicode_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "sys_", "._", "getfile", "system", "encoding_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "Run", "time", "Error", "(", "locald", "ir", ")_", "\\u\\u\\uNL\\u\\u\\u_", "mods_", "=_", "new", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import", "\\u", "md_", "(_", "os_", "._", "path_", "._", "join_", "(_", "locald", "ir_", ",_", "'", "src", "/", "main", ".", "md", "'_", ")_", ",_", "modules_", "=_", "mods_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "mods_", "[_", "'", "python", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "##", " ", "this", " ", "is", " ", "simplified", " ", "bec", "aus", "e", " ", "rust", "hon", "'", "s", " ", "source", " ", "is", " ", "pure", " ", "python_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "src_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BOOT", "STRA", "PED", "_", "=_", "src_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'--", "dump", "'_", "in_", "sys_", "._", "argv_", ":_", "open_", "(_", "'/", "tmp", "/", "boots", "trap", "-", "rust", "hon", ".", "py", "'_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "src_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "(_", "src_", ",_", "globals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'--", "test", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "test\\u", "typed", "python_", "(_", ")_", "##", " ", "runs", " ", "some", " ", "basic", " ", "tests", " ", "on", " ", "the", " ", "extend", "ed", " ", "syntax_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'--", "runt", "ime", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "print_", "(_", "'", "creati", "ng", " ", "new", " ", "runt", "ime", ":", " ", "python", "js", ".", "js", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "js", "runtime_", "=_", "generat", "e\\u", "js", "\\u", "runtime_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "'./", "python", "js", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "'", "saving", " ", "runt", "ime", " ", "to", " ", "python", "js", "/", "python", "js", ".", "js", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "'", "python", "js", "/", "python", "js", ".", "js", "'_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "js", "runtime_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "js", "runtime_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
kdart/pycopia/QA/pycopia/QA/core.py
[ { "content": " def __call__(self, *args, **kwargs):\n \"\"\"Invoke the test.\n\n The test is \"kicked-off\" by calling this. Any arguments are passed to\n the test implementation (`execute` method).\n \"\"\"\n self.config.register_testcase(self.test_name)\n self._report.add_heading(self.test_name, 2)\n if args or kwargs:\n self._report.add_message(\"TESTARGUMENTS\", repr_args(args, kwargs), 2)\n self.starttime = timelib.now() # saved starttime in case initializer\n # needs to create the log file.\n self._initialize()\n # test elapsed time does not include initializer time.\n teststarttime = timelib.now()\n # run the execute() method and check for exceptions.\n try:\n rv = self.execute(*args, **kwargs)\n except KeyboardInterrupt:\n if self._debug:\n ex, val, tb = sys.exc_info()\n debugger.post_mortem(tb, ex, val)\n rv = self.incomplete(\"%s: aborted by user.\" % self.test_name)\n self._finalize(rv)\n raise\n except TestFailError, errval:\n rv = self.failed(\"Caught Fail exception: %s\" % (errval,))\n except TestIncompleteError, errval:\n rv = self.incomplete(\"Caught incomplete exception: %s\" % (errval,))\n # Test asserts and validation errors are based on this.\n except AssertionError as errval:\n rv = self.failed(\"failed assertion: %s\" % (errval,))\n except TestSuiteAbort:\n self.config.register_testcase(None)\n raise # pass this one up to suite\n except debugger.DebuggerQuit: # set_trace \"leaks\" BdbQuit\n rv = self.incomplete(\"%s: Debugger exit.\" % (self.test_name, ))\n except ConfigError as cerr:\n rv = self.incomplete(\"Configuration error: {}\".format(cerr))\n self.config.register_testcase(None)\n if self._debug:\n ex, val, tb = sys.exc_info()\n debugger.post_mortem(tb, ex, val)\n tb = None\n raise TestSuiteAbort(cerr)\n except:\n ex, val, tb = sys.exc_info()\n if self._debug:\n debugger.post_mortem(tb, ex, val)\n tb = None\n rv = self.incomplete(\"%s: Exception: (%s: %s)\" % (self.test_name, ex, val))\n endtime = timelib.now()\n self.config.register_testcase(None)\n self._report.add_message(\"STARTTIME\", teststarttime, 2)\n self._report.add_message(\"ENDTIME\", endtime, 2)\n minutes, seconds = divmod(endtime - teststarttime, 60.0)\n hours, minutes = divmod(minutes, 60.0)\n self.info(\"Time elapsed: %02.0f:%02.0f:%02.2f\" % (hours, minutes, seconds))\n return self._finalize(rv)", "metadata": "root.Test.__call__", "header": "['class', 'Test', '(', 'object', ')', ':', '___EOS___']", "index": 173 }, { "content": " def _initialize(self):\n \"\"\"initialize phase handler.\n\n Run user-defined `initialize()` and catch exceptions. If an exception\n occurs in the `initialize()` method (which establishes the\n pre-conditions for a test) then alter the return value to abort()\n which will abort the suite. Invokes the debugger if the debug flag is\n set. If debug flag is not set then emit a diagnostic message to the\n report.\n \"\"\"\n try:\n self.initialize()\n except:\n ex, val, tb = sys.exc_info()\n self.diagnostic(\"%s (%s)\" % (ex, val))\n if self._debug:\n debugger.post_mortem(tb, ex, val)\n self.abort(\"Test initialization failed!\")", "metadata": "root.Test._initialize", "header": "['class', 'Test', '(', 'object', ')', ':', '___EOS___']", "index": 233 }, { "content": " def _finalize(self, rv):\n \"\"\"\n Run user-defined `finalize()` and catch exceptions. If an exception\n occurs in the finalize() method (which is supposed to clean up from\n the test and leave the UUT in the same condition as when it was\n entered) then alter the return value to abort() which will abort the\n suite. Invokes the debugger if the debug flag is set.\n \"\"\"\n try:\n self.finalize(rv)\n except:\n ex, val, tb = sys.exc_info()\n self.diagnostic(\"%s (%s)\" % (ex, val))\n if self._debug:\n debugger.post_mortem(tb, ex, val)\n self.abort(\"Test finalize failed!\")\n return rv", "metadata": "root.Test._finalize", "header": "['class', 'Test', '(', 'object', ')', ':', '___EOS___']", "index": 252 }, { "content": " def _finalize(self):\n try:\n self.finalize()\n except KeyboardInterrupt:\n if self._nested:\n raise TestSuiteAbort(\n \"Suite {!r} aborted by user in finalize().\".format(self.test_name))\n else:\n self.info(\"Suite aborted by user in finalize().\")\n except:\n ex, val, tb = sys.exc_info()\n if self._debug:\n print # ensure debugger prompts starts on new line.\n debugger.post_mortem(tb, ex, val)\n self.info(\"Suite failed to finalize: %s (%s)\" % (ex, val))\n if self._nested:\n raise TestSuiteAbort(\n \"subordinate suite {!r} failed to finalize.\".format(self.test_name))\n self._summarize()\n self._report_summary()\n return self.result", "metadata": "root.TestSuite._finalize", "header": "['class', 'TestSuite', '(', 'object', ')', ':', '___EOS___']", "index": 1302 } ]
[ { "span": "except:", "start_line": 218, "start_column": 8, "end_line": 218, "end_column": 15 }, { "span": "except:", "start_line": 245, "start_column": 8, "end_line": 245, "end_column": 15 }, { "span": "except:", "start_line": 262, "start_column": 8, "end_line": 262, "end_column": 15 }, { "span": "except:", "start_line": 1311, "start_column": 8, "end_line": 1311, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Invok", "e", " ", "the", " ", "test", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "test", " ", "is", " ", "\"", "kick", "ed", "-", "off", "\"", " ", "by", " ", "calling", " ", "this", ".", " ", "Any", " ", "argu", "ment", "s", " ", "are", " ", "pass", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "test", " ", "implementation", " ", "(", "`", "execute", "`", " ", "method", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "._", "register", "\\u", "testcase_", "(_", "self_", "._", "test\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "report_", "._", "add", "\\u", "heading_", "(_", "self_", "._", "test\\u", "name_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "or_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "report_", "._", "add", "\\u", "message_", "(_", "\"", "TEST", "ARGUMENT", "S", "\"_", ",_", "repr", "\\u", "args_", "(_", "args_", ",_", "kwargs_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "starttime_", "=_", "timeli", "b_", "._", "now_", "(_", ")_", "#", " ", "saved", " ", "startt", "ime", " ", "in", " ", "case", " ", "initializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "need", "s", " ", "to", " ", "create", " ", "the", " ", "log", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "initialize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "ela", "pse", "d", " ", "time", " ", "doe", "s", " ", "not", " ", "include", " ", "initializer", " ", "time", "._", "\\u\\u\\uNL\\u\\u\\u_", "tests", "tart", "time_", "=_", "timeli", "b_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "run", " ", "the", " ", "execute", "()", " ", "method", " ", "and", " ", "check", " ", "for", " ", "exception", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rv_", "=_", "self_", "._", "execute_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", ",_", "val_", ",_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debugger_", "._", "post", "\\u", "mort", "em_", "(_", "tb_", ",_", "ex_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rv_", "=_", "self_", "._", "incomplete", "_", "(_", "\"%", "s", ":", " ", "abort", "ed", " ", "by", " ", "user", ".\"_", "%_", "self_", "._", "test\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "finalize_", "(_", "rv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Test", "Fail", "Error_", ",_", "err", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rv_", "=_", "self_", "._", "failed_", "(_", "\"", "Cau", "ght", " ", "Fail", " ", "exception", ":", " ", "%", "s", "\"_", "%_", "(_", "err", "val_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Test", "Incomp", "lete", "Error_", ",_", "err", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rv_", "=_", "self_", "._", "incomplete", "_", "(_", "\"", "Cau", "ght", " ", "incomplete", " ", "exception", ":", " ", "%", "s", "\"_", "%_", "(_", "err", "val_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "asserts", " ", "and", " ", "validation", " ", "error", "s", " ", "are", " ", "based", " ", "on", " ", "this", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Assert", "ion", "Error_", "as_", "err", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rv_", "=_", "self_", "._", "failed_", "(_", "\"", "fail", "ed", " ", "assertion", ":", " ", "%", "s", "\"_", "%_", "(_", "err", "val_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Test", "Suit", "e", "Abort_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config_", "._", "register", "\\u", "testcase_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "#", " ", "pass", " ", "this", " ", "one", " ", "up", " ", "to", " ", "suite_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "debugger_", "._", "Debugger", "Quit_", ":_", "#", " ", "set\\u", "trace", " ", "\"", "leak", "s", "\"", " ", "Bd", "b", "Quit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rv_", "=_", "self_", "._", "incomplete", "_", "(_", "\"%", "s", ":", " ", "Debugger", " ", "exit", ".\"_", "%_", "(_", "self_", "._", "test\\u", "name_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Config", "Error_", "as_", "cer", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rv_", "=_", "self_", "._", "incomplete", "_", "(_", "\"", "Configura", "tion", " ", "error", ":", " ", "{}\"_", "._", "format_", "(_", "cer", "r_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "._", "register", "\\u", "testcase_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", ",_", "val_", ",_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debugger_", "._", "post", "\\u", "mort", "em_", "(_", "tb_", ",_", "ex_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Test", "Suit", "e", "Abort_", "(_", "cer", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", ",_", "val_", ",_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debugger_", "._", "post", "\\u", "mort", "em_", "(_", "tb_", ",_", "ex_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rv_", "=_", "self_", "._", "incomplete", "_", "(_", "\"%", "s", ":", " ", "Except", "ion", ":", " ", "(%", "s", ":", " ", "%", "s", ")\"_", "%_", "(_", "self_", "._", "test\\u", "name_", ",_", "ex_", ",_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "endtime_", "=_", "timeli", "b_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "._", "register", "\\u", "testcase_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "report_", "._", "add", "\\u", "message_", "(_", "\"", "START", "TIME", "\"_", ",_", "tests", "tart", "time_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "report_", "._", "add", "\\u", "message_", "(_", "\"", "END", "TIME", "\"_", ",_", "endtime_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "minutes_", ",_", "seconds_", "=_", "divmod_", "(_", "endtime_", "-_", "tests", "tart", "time_", ",_", "60.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hours_", ",_", "minutes_", "=_", "divmod_", "(_", "minutes_", ",_", "60.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "info_", "(_", "\"", "Time", " ", "ela", "pse", "d", ":", " ", "%", "02", ".0", "f", ":", "%", "02", ".0", "f", ":", "%", "02", ".2", "f", "\"_", "%_", "(_", "hours_", ",_", "minutes_", ",_", "seconds_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "finalize_", "(_", "rv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "initialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "initialize", " ", "phase", " ", "handler", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "user", "-", "defin", "ed", " ", "`", "initialize", "()`", " ", "and", " ", "catch", " ", "exception", "s", ".", " ", "If", " ", "an", " ", "exception", "\\", "10", ";", " ", " ", " ", " ", "occur", "s", " ", "in", " ", "the", " ", "`", "initialize", "()`", " ", "method", " ", "(", "whi", "ch", " ", "establish", "es", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "pre", "-", "condition", "s", " ", "for", " ", "a", " ", "test", ")", " ", "then", " ", "alter", " ", "the", " ", "return", " ", "value", " ", "to", " ", "abort", "()", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "will", " ", "abort", " ", "the", " ", "suit", "e", ".", " ", "Invok", "es", " ", "the", " ", "debugg", "er", " ", "if", " ", "the", " ", "debug", " ", "flag", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "set", ".", " ", "If", " ", "debug", " ", "flag", " ", "is", " ", "not", " ", "set", " ", "then", " ", "emit", " ", "a", " ", "diagnostic", " ", "message", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "report", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "initialize_", "(_", ")_", "\\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 ", " _", "ex_", ",_", "val_", ",_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "diagnostic", "_", "(_", "\"%", "s", " ", "(%", "s", ")\"_", "%_", "(_", "ex_", ",_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debugger_", "._", "post", "\\u", "mort", "em_", "(_", "tb_", ",_", "ex_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "abort_", "(_", "\"", "Test", " ", "initialization", " ", "fail", "ed", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test_", "(_", "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", "finalize_", "(_", "self_", ",_", "rv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "user", "-", "defin", "ed", " ", "`", "finalize", "()`", " ", "and", " ", "catch", " ", "exception", "s", ".", " ", "If", " ", "an", " ", "exception", "\\", "10", ";", " ", " ", " ", " ", "occur", "s", " ", "in", " ", "the", " ", "finalize", "()", " ", "method", " ", "(", "whi", "ch", " ", "is", " ", "supposed", " ", "to", " ", "clean", " ", "up", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "test", " ", "and", " ", "lea", "ve", " ", "the", " ", "UU", "T", " ", "in", " ", "the", " ", "same", " ", "condition", " ", "as", " ", "whe", "n", " ", "it", " ", "was", "\\", "10", ";", " ", " ", " ", " ", "enter", "ed", ")", " ", "then", " ", "alter", " ", "the", " ", "return", " ", "value", " ", "to", " ", "abort", "()", " ", "whi", "ch", " ", "will", " ", "abort", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "suit", "e", ".", " ", "Invok", "es", " ", "the", " ", "debugg", "er", " ", "if", " ", "the", " ", "debug", " ", "flag", " ", "is", " ", "set", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "finalize_", "(_", "rv_", ")_", "\\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 ", " _", "ex_", ",_", "val_", ",_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "diagnostic", "_", "(_", "\"%", "s", " ", "(%", "s", ")\"_", "%_", "(_", "ex_", ",_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debugger_", "._", "post", "\\u", "mort", "em_", "(_", "tb_", ",_", "ex_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "abort_", "(_", "\"", "Test", " ", "finalize", " ", "fail", "ed", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Suite_", "(_", "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", "finalize_", "(_", "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_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "nested_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Suit", "e", "Abort_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Suit", "e", " ", "{", "!", "r", "}", " ", "abort", "ed", " ", "by", " ", "user", " ", "in", " ", "finalize", "().\"", "_", "._", "format_", "(_", "self_", "._", "test\\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 ", " _", "self_", "._", "info_", "(_", "\"", "Suit", "e", " ", "abort", "ed", " ", "by", " ", "user", " ", "in", " ", "finalize", "().\"", "_", ")_", "\\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 ", " _", "ex_", ",_", "val_", ",_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "#", " ", "ensure", " ", "debugg", "er", " ", "prompt", "s", " ", "starts", " ", "on", " ", "new", " ", "line", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debugger_", "._", "post", "\\u", "mort", "em_", "(_", "tb_", ",_", "ex_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "info_", "(_", "\"", "Suit", "e", " ", "fail", "ed", " ", "to", " ", "finalize", ":", " ", "%", "s", " ", "(%", "s", ")\"_", "%_", "(_", "ex_", ",_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "nested_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Suit", "e", "Abort_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "subo", "rdin", "ate", " ", "suit", "e", " ", "{", "!", "r", "}", " ", "fail", "ed", " ", "to", " ", "finalize", ".\"_", "._", "format_", "(_", "self_", "._", "test\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "summarize", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "report", "\\u", "summary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 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 ]
First parameter of a method is not named 'self'
PyCQA/pycodestyle/testsuite/E30not.py
[ { "content": " def a():\n pass", "metadata": "root.X.a", "header": "['class', 'X', ':', '___EOS___']", "index": 18 }, { "content": " def b():\n pass", "metadata": "root.X.b", "header": "['class', 'X', ':', '___EOS___']", "index": 22 }, { "content": " def c():\n pass", "metadata": "root.X.c", "header": "['class', 'X', ':', '___EOS___']", "index": 28 }, { "content": " def a():\n pass", "metadata": "root.Y.a", "header": "['class', 'Y', ':', '___EOS___']", "index": 38 }, { "content": " def b():\n pass", "metadata": "root.Y.b", "header": "['class', 'Y', ':', '___EOS___']", "index": 43 }, { "content": " def b():\n\n pass", "metadata": "root.Foo.b", "header": "['class', 'Foo', '(', ')', ':', '___EOS___']", "index": 84 } ]
[ { "span": "def a():", "start_line": 18, "start_column": 4, "end_line": 18, "end_column": 12 }, { "span": "def b():", "start_line": 22, "start_column": 4, "end_line": 22, "end_column": 12 }, { "span": "def c():", "start_line": 28, "start_column": 4, "end_line": 28, "end_column": 12 }, { "span": "def a():", "start_line": 38, "start_column": 4, "end_line": 38, "end_column": 12 }, { "span": "def b():", "start_line": 43, "start_column": 4, "end_line": 43, "end_column": 12 }, { "span": "def b():", "start_line": 84, "start_column": 4, "end_line": 84, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "X_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "a_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "X_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "b_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "X_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "c_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Y_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "a_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Y_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "b_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foo_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "b_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
quantopian/zipline/tests/risk/test_risk_period.py
[ { "content": " def test_factory(self):\n returns = [0.1] * 100\n r_objects = factory.create_returns_from_list(returns, self.sim_params)\n self.assertTrue(r_objects.index[-1] <=\n datetime.datetime(\n year=2006, month=12, day=31, tzinfo=pytz.utc))", "metadata": "root.TestRisk.test_factory", "header": "['class', 'TestRisk', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 103 } ]
[ { "span": "self.assertTrue(r_objects.index[-1] <=\n datetime.datetime(\n year=2006, month=12, day=31, tzinfo=pytz.utc))", "start_line": 106, "start_column": 8, "end_line": 108, "end_column": 74 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Ris", "k_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "factory_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "returns_", "=_", "[_", "0.1_", "]_", "*_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "objects_", "=_", "factory_", "._", "create", "\\u", "return", "s", "\\u", "from", "\\u", "list_", "(_", "returns_", ",_", "self_", "._", "sim", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "r", "\\u", "objects_", "._", "index_", "[_", "-_", "1_", "]_", "<=_", "\\u\\u\\uNL\\u\\u\\u_", "datetime_", "._", "datetime_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "year_", "=_", "2006", "_", ",_", "month_", "=_", "12_", ",_", "day_", "=_", "31_", ",_", "tzinfo_", "=_", "pytz_", "._", "utc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
Comparison using is when operands support `__eq__`
SteveAbb/Vestigo/Vestigo/scan.py
[ { "content": "\tdef getAddresses(self,type=None):\n\t\tfetchNewAssets=False\n\t\tif(self._lastFetch is not None):\n\t\t\tif((time.time()-self._lastFetch)>int(self._settings.baseServer_Recache)):\n\t\t\t\tfetchNewAssets=True\n\t\telse:\n\t\t\tfetchNewAssets=True\n\t\t\n\t\tif(fetchNewAssets):\n\t\t\ttry:\n\t\t\t\tself._lastFetch=time.time()\n\t\t\t\tself.log(\"Recaching\")\n\t\t\t\tresp=requests.get(self._settings.baseServer_URL+\"/addresses/?reader=\"+self._settings.baseServer_Reader,timeout=int(self._settings.baseServer_Timeout))\n\t\t\t\tself._addresses=resp.json()\n\t\t\t\tself.log(\"Finished recache.\")\n\t\t\t\tself._nonDiscKeepScanning=False\n\t\t\texcept Exception,error:\n\t\t\t\tself.log(\"Error rechaching addresses: \"+str(error)+\". Will retry on next recache.\")\n\t\t\n\t\tif(type is None):\t\n\t\t\treturn self._addresses\n\t\telif(type is \"all\"):\n\t\t\treturn dict(self._addresses[\"ble\"].items() + self._addresses[\"disc\"].items()+self._addresses[\"nonDisc\"].items())\n\t\telse:\n\t\t\treturn self._addresses[type]", "metadata": "root.Scanner.getAddresses", "header": "['class', 'Scanner', '(', ')', ':', '___EOS___']", "index": 27 } ]
[ { "span": "type is \"all\")", "start_line": 48, "start_column": 7, "end_line": 48, "end_column": 20 } ]
[]
1
false
[ "[CLS]_", "Compari", "son_", "using_", "is_", "when_", "operands_", "support_", " _", "`_", "\\u\\u", "eq\\u\\u_", "`_", "[SEP]_", "class_", "Scanner_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Address", "es_", "(_", "self_", ",_", "type_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "fetch", "New", "Asset", "s_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "last", "Fe", "tch_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "(_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "self_", "._", "\\u", "last", "Fe", "tch_", ")_", ">_", "int_", "(_", "self_", "._", "\\u", "settings_", "._", "base", "Server", "\\u", "Rec", "ache_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "fetch", "New", "Asset", "s_", "=_", "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\t", "\t\t_", "fetch", "New", "Asset", "s_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "fetch", "New", "Asset", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "self_", "._", "\\u", "last", "Fe", "tch_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "\"", "Rec", "achi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "requests_", "._", "get_", "(_", "self_", "._", "\\u", "settings_", "._", "base", "Server", "\\u", "URL_", "+_", "\"/", "addresse", "s", "/?", "reader", "=\"_", "+_", "self_", "._", "\\u", "settings_", "._", "base", "Server", "\\u", "Reader_", ",_", "timeout_", "=_", "int_", "(_", "self_", "._", "\\u", "settings_", "._", "base", "Server", "\\u", "Timeout_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "addresses_", "=_", "resp_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "\"", "Finish", "ed", " ", "reca", "che", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "non", "Disc", "Keep", "Scann", "ing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "self_", "._", "log_", "(_", "\"", "Error", " ", "rech", "achi", "ng", " ", "addresse", "s", ":", " ", "\"_", "+_", "str_", "(_", "error_", ")_", "+_", "\".", " ", "Wil", "l", " ", "retr", "y", " ", "on", " ", "next", " ", "reca", "che", ".\"_", ")_", "\\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_", "(_", "type_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "self_", "._", "\\u", "addresses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "type_", "is_", "\"", "all", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "dict_", "(_", "self_", "._", "\\u", "addresses_", "[_", "\"", "ble", "\"_", "]_", "._", "items_", "(_", ")_", "+_", "self_", "._", "\\u", "addresses_", "[_", "\"", "disc", "\"_", "]_", "._", "items_", "(_", ")_", "+_", "self_", "._", "\\u", "addresses_", "[_", "\"", "non", "Disc", "\"_", "]_", "._", "items_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "self_", "._", "\\u", "addresses_", "[_", "type_", "]_", "\\u\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
ybrs/pydisque/pydisque/client.py
[ { "content": " def connect(self):\n \"\"\"\n Connect to one of the Disque nodes.\n\n You can get current connection with connected_node property\n\n :returns: nothing\n \"\"\"\n self.connected_node = None\n for i, node in self.nodes.items():\n host, port = i.split(':')\n port = int(port)\n redis_client = redis.Redis(host, port)\n try:\n ret = redis_client.execute_command('HELLO')\n format_version, node_id = ret[0], ret[1]\n others = ret[2:]\n self.nodes[i] = Node(node_id, host, port, redis_client)\n self.connected_node = self.nodes[i]\n except redis.exceptions.ConnectionError:\n pass\n if not self.connected_node:\n raise Exception('couldnt connect to any nodes')\n logger.info(\"connected to node %s\" % self.connected_node)", "metadata": "root.Client.connect", "header": "['class', 'Client', '(', 'object', ')', ':', '___EOS___']", "index": 108 } ]
[ { "span": "others ", "start_line": 124, "start_column": 16, "end_line": 124, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Connect", " ", "to", " ", "one", " ", "of", " ", "the", " ", "Dis", "que", " ", "nodes", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "get", " ", "current", " ", "connecti", "on", " ", "with", " ", "connect", "ed", "\\u", "node", " ", "property", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "not", "hing", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connect", "ed", "\\u", "node_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "node_", "in_", "self_", "._", "nodes_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", ",_", "port_", "=_", "i_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "int_", "(_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redis", "\\u", "client_", "=_", "redis_", "._", "Redis_", "(_", "host_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "redis", "\\u", "client_", "._", "execute", "\\u", "command_", "(_", "'", "HELL", "O", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "format\\u", "version_", ",_", "node", "\\u", "id_", "=_", "ret_", "[_", "0_", "]_", ",_", "ret_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "others_", "=_", "ret_", "[_", "2_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nodes_", "[_", "i_", "]_", "=_", "Node_", "(_", "node", "\\u", "id_", ",_", "host_", ",_", "port_", ",_", "redis", "\\u", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connect", "ed", "\\u", "node_", "=_", "self_", "._", "nodes_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "redis_", "._", "exceptions_", "._", "Connect", "ion", "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_", "self_", "._", "connect", "ed", "\\u", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "coul", "dn", "t", " ", "connect", " ", "to", " ", "any", " ", "nodes", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "connect", "ed", " ", "to", " ", "node", " ", "%", "s", "\"_", "%_", "self_", "._", "connect", "ed", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
Esri/solutions-geoprocessing-toolbox/suitability/test/test_path_slope/TestPathSlope.py
[ { "content": "#------------------------------------------------------------------------------\n# Copyright 2013 Esri\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# TestPathSlope.py\n# Description: Test Path Slope Toolbox\n# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension\n# ----------------------------------------------------------------------------\n\nimport arcpy\nimport sys\nimport traceback\nimport TestUtilities\nimport os\n\n\ntry:\n if arcpy.CheckExtension(\"Spatial\") == \"Available\":\n arcpy.CheckOutExtension(\"Spatial\")\n \n else:\n raise LicenseError\n \n arcpy.ImportToolbox(TestUtilities.toolbox)\n arcpy.env.overwriteOutput = True\n \n inputPolyArea = os.path.join(TestUtilities.inputGDB, \"samplePolygonArea\")\n inputRoads = os.path.join(TestUtilities.inputGDB, \"roads\")\n inputSurface = os.path.join(TestUtilities.inputGDB, \"Jbad_SRTM_USGS_EROS\")\n psOutput = os.path.join(TestUtilities.outputGDB, \"PathSlopeOutput\")\n \n #Testing Path Slope\n arcpy.AddMessage(\"Starting Test: Path Slope Tools\")\n arcpy.PathSlope_path(inputPolyArea,inputRoads, inputSurface, psOutput)\n \n #Verify Results\n outputFeatureCount = int(arcpy.GetCount_management(psOutput).getOutput(0)) \n print(\"Output FeatureClass: \" + str(psOutput))\n print(\"Output Feature Count: \" + str(outputFeatureCount))\n \n if (outputFeatureCount < 1):\n print(\"Invalid Output Feature Count: \" + str(outputFeatureCount))\n raise Exception(\"Test Failed\") \n\n print(\"Test Passed\")\n\nexcept LicenseError:\n print(\"Spatial Analyst license is unavailable\")\n\nexcept arcpy.ExecuteError: \n # Get the arcpy error messages \n msgs = arcpy.GetMessages() \n arcpy.AddError(msgs) \n print(msgs)\n \n # return a system error code\n sys.exit(-1)\n\nexcept:\n # Get the traceback object\n tb = sys.exc_info()[2]\n tbinfo = traceback.format_tb(tb)[0]\n\n # Concatenate information together concerning the error into a message string\n pymsg = \"PYTHON ERRORS:\\nTraceback info:\\n\" + tbinfo + \"\\nError Info:\\n\" + str(sys.exc_info()[1])\n msgs = \"ArcPy ERRORS:\\n\" + arcpy.GetMessages() + \"\\n\"\n\n # Return python error messages for use in script tool or Python Window\n arcpy.AddError(pymsg)\n arcpy.AddError(msgs)\n\n # Print Python error messages for use in Python / Python Window\n print(pymsg + \"\\n\")\n print(msgs)\n \n # return a system error code \n sys.exit(-1)\n \nfinally:\n if arcpy.CheckExtension(\"Spatial\") == \"Available\":\n arcpy.CheckInExtension(\"Spatial\")", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 70, "start_column": 0, "end_line": 70, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", " ", "Es", "ri_", "\\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_", "#", " ", "Test", "Path", "Slope", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Descripti", "on", ":", " ", "Test", " ", "Path", " ", "Slope", " ", "Toolb", "ox_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Requirements", ":", " ", "Arc", "GI", "S", " ", "Des", "kto", "p", " ", "Standard", " ", "with", " ", "Spa", "tial", " ", "Analy", "st", " ", "Extension_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "arcpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Test", "Utilities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arcpy_", "._", "Check", "Extension_", "(_", "\"", "Spa", "tial", "\"_", ")_", "==_", "\"", "Avail", "able", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Check", "Out", "Extension_", "(_", "\"", "Spa", "tial", "\"_", ")_", "\\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 ", " _", "raise_", "License", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Import", "Toolb", "ox_", "(_", "Test", "Utilities_", "._", "toolbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "env_", "._", "overwrit", "e", "Output_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Poly", "Area_", "=_", "os_", "._", "path_", "._", "join_", "(_", "Test", "Utilities_", "._", "input", "GD", "B_", ",_", "\"", "sample", "Polygon", "Area", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "Roa", "ds_", "=_", "os_", "._", "path_", "._", "join_", "(_", "Test", "Utilities_", "._", "input", "GD", "B_", ",_", "\"", "road", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "Surface_", "=_", "os_", "._", "path_", "._", "join_", "(_", "Test", "Utilities_", "._", "input", "GD", "B_", ",_", "\"", "J", "bad", "\\u", "SR", "TM", "\\u", "US", "GS", "\\u", "ERO", "S", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ps", "Output_", "=_", "os_", "._", "path_", "._", "join_", "(_", "Test", "Utilities_", "._", "output", "GD", "B_", ",_", "\"", "Path", "Slope", "Output", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", "ing", " ", "Path", " ", "Slope", "_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Start", "ing", " ", "Test", ":", " ", "Path", " ", "Slope", " ", "Tool", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Path", "Slope", "\\u", "path_", "(_", "input", "Poly", "Area_", ",_", "input", "Roa", "ds_", ",_", "input", "Surface_", ",_", "ps", "Output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Verify", " ", "Results_", "\\u\\u\\uNL\\u\\u\\u_", "output", "Feature", "Count_", "=_", "int_", "(_", "arcpy_", "._", "Get", "Count", "\\u", "management_", "(_", "ps", "Output_", ")_", "._", "get", "Output_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Output", " ", "Feature", "Class", ":", " ", "\"_", "+_", "str_", "(_", "ps", "Output_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Output", " ", "Feature", " ", "Count", ":", " ", "\"_", "+_", "str_", "(_", "output", "Feature", "Count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "output", "Feature", "Count_", "<_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Inva", "lid", " ", "Output", " ", "Feature", " ", "Count", ":", " ", "\"_", "+_", "str_", "(_", "output", "Feature", "Count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "\"", "Test", " ", "Fail", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Test", " ", "Passe", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "License", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Spa", "tial", " ", "Analy", "st", " ", "license", " ", "is", " ", "unava", "ilab", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "arcpy_", "._", "Execut", "e", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "arc", "py", " ", "error", " ", "message", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msgs_", "=_", "arcpy_", "._", "Get", "Messages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "a", " ", "system", " ", "error", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "exit_", "(_", "-_", "1_", ")_", "\\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_", "#", " ", "Get", " ", "the", " ", "traceback", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb", "info_", "=_", "traceback_", "._", "format\\u", "tb_", "(_", "tb_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Concat", "enat", "e", " ", "informati", "on", " ", "tog", "ether", " ", "concern", "ing", " ", "the", " ", "error", " ", "int", "o", " ", "a", " ", "message", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "pym", "sg_", "=_", "\"", "PYTHON", " ", "ERRORS", ":\\\\", "n", "Trace", "back", " ", "info", ":\\\\", "n", "\"_", "+_", "tb", "info_", "+_", "\"\\\\", "n", "Error", " ", "Info", ":\\\\", "n", "\"_", "+_", "str_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs_", "=_", "\"", "Arc", "Py", " ", "ERRORS", ":\\\\", "n", "\"_", "+_", "arcpy_", "._", "Get", "Messages_", "(_", ")_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "python", " ", "error", " ", "message", "s", " ", "for", " ", "use", " ", "in", " ", "script", " ", "tool", " ", "or", " ", "Pyth", "on", " ", "Window_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "pym", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Print", " ", "Pyth", "on", " ", "error", " ", "message", "s", " ", "for", " ", "use", " ", "in", " ", "Pyth", "on", " ", "/", " ", "Pyth", "on", " ", "Window_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "pym", "sg_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "a", " ", "system", " ", "error", " ", "code", " _", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "exit_", "(_", "-_", "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 ", " _", "if_", "arcpy_", "._", "Check", "Extension_", "(_", "\"", "Spa", "tial", "\"_", ")_", "==_", "\"", "Avail", "able", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Check", "In", "Extension_", "(_", "\"", "Spa", "tial", "\"_", ")_" ]
[ 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, 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